File: python3fix.patch

package info (click to toggle)
ardentryst 1.71-11
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 33,160 kB
  • sloc: python: 12,013; xml: 140; sh: 8; makefile: 2
file content (73 lines) | stat: -rw-r--r-- 2,805 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
Python 3 port introduced at least five severe bugs.

* Customizing action keys via Options, Control prints 2 deprecation warnings
  and no longer works, changed keys aren't saved. Not being able to remap
  keys makes it hard for users of non-English keyboards. (controls.py)
* Playing as Nyx and casting Ice ([D][S]) or Implosion ([D][W]) instantly
  crashes the game due to 3 exceptions. (magic.py)
* Playing as Pyralis and using Spin-slash ([C][S]) hangs gameplay, you have
  to abort the current level to be able to move again. (play_level.py)

Bug-Debian: https://bugs.debian.org/1001823
Signed-off-by: Jens Rottmann

--- ardentryst/controls.py
+++ python3fix/controls.py
@@ -35,7 +35,7 @@
 class SET2:
     def __init__(self, keycodes, x, y, set):
         self.set = set
-        self.keys = [Key(keycodes[c], x + ((8-c)%3) * 32, y + (c/3)*30, "B-" + str(((11-c)/3)*3 - (11-c)%3), set) for c in range(9)]
+        self.keys = [Key(keycodes[c], x + ((8-c)%3) * 32, y + (c//3)*30, "B-" + str(((11-c)//3)*3 - (11-c)%3), set) for c in range(9)]
 
 class Key:
     def __init__(self, keycode, x, y, binding, set):
--- ardentryst/magic.py
+++ python3fix/magic.py
@@ -21,7 +21,6 @@
 
 import pygame, math, random
 from pygame.locals import *
-from past.builtins import cmp
 
 def ground_at(LEVEL, x, f=False):
     "Finds the y co-ordinate of the ground at position x."
@@ -236,7 +235,7 @@ class Ice_1(Spell):
     def s_init(self):
         global DATA
         self.affected = []
-        self.cant = self.caster.mp < 4
+        self.cant = self.caster.mp[0] < 4
     def s_blit(self, surf, ALT_X, ALT_Y):
         global DATA
         if not self.affected:
@@ -441,7 +440,7 @@ class Implosion_1(Spell):
     def s_init(self):
         global DATA
         self.affected = []
-        self.cant = self.caster.mp < 15
+        self.cant = self.caster.mp[0] < 15
     def s_blit(self, surf, ALT_X, ALT_Y):
         global DATA
         pic = DATA.mag_images["bubble.png"][0]
@@ -472,7 +471,7 @@ class Implosion_1(Spell):
                     if self.caster.mp[0] >= 15:
                         self.affected.append(monster)
 
-            self.affected.sort(lambda x, y: cmp(y.maxhp, x.maxhp))
+            self.affected.sort(key=lambda x: -x.maxhp)
 
             if len(self.affected):
                 self.affected = self.affected[:1]
--- ardentryst/play_level.py
+++ python3fix/play_level.py
@@ -4727,7 +4727,7 @@ class Character:
             self.mycombotime -= 1
             if self.chainmove[1] and self.chainmove[1] > 0:
                 self.chainmove[1] -= 1
-            if self.chainmove[1] and self.chainmove[1] == 0:
+            if self.chainmove[1] == 0:
                 cm = self.chainmove[:]
                 self.chainmove = [None, None]
                 getattr(self, cm[0])()
--