@@ -25,13 +25,40 @@ def attack(self):
2525 )
2626 self .poke .ico .map .show ()
2727 time .sleep (SPEED_OF_TIME * _t )
28+ self .impact ()
29+
30+ def impact (self ):
31+ """Brief flash effect on enemy when attack lands"""
32+ if self .poke .enem == self .poke :
33+ return
34+ enem_ico = self .poke .enem .ico
35+ flash_chars = ["*" , "X" , "*" ]
36+ flash = se .Text (flash_chars [0 ], esccode = Color .thicc + Color .yellow )
37+ flash .add (
38+ enem_ico .map ,
39+ * (
40+ (enem_ico .x , enem_ico .y + enem_ico .height )
41+ if self .poke .player
42+ else (
43+ enem_ico .x + enem_ico .width ,
44+ enem_ico .y ,
45+ )
46+ ),
47+ )
48+ for char in flash_chars :
49+ flash .rechar (char , esccode = Color .thicc + Color .yellow )
50+ enem_ico .map .show ()
51+ time .sleep (SPEED_OF_TIME * 0.1 )
52+ flash .remove ()
53+ enem_ico .map .show ()
2854
2955 def pound (self ):
3056 """Pound move"""
3157 for i in [- 1 , 1 ]:
3258 self .poke .ico .move (0 , i )
3359 self .poke .ico .map .show ()
3460 time .sleep (SPEED_OF_TIME * 0.3 )
61+ self .impact ()
3562
3663 def bomb (self ):
3764 """Bomb move"""
@@ -82,7 +109,7 @@ def bomb(self):
82109 text .add (
83110 _map , round ((_map .width - 11 ) / 2 ), round ((_map .height - 9 ) / 2 )
84111 )
85- self .throw (Color .thicc + Color .blue + "o" + Color .reset , 0.5 )
112+ self .__throw (Color .thicc + Color .blue + "o" + Color .reset , 0.5 )
86113 for i in frames :
87114 text .rechar (i )
88115 self .poke .ico .map .show ()
@@ -114,12 +141,17 @@ def arch(self):
114141 line .remove ()
115142 del line
116143
117- def throw (self , txt = "#" , factor = 1.0 , num = 1 ):
118- """Throw move
144+ def throw (self ):
145+ self .__throw ()
146+ self .impact ()
147+
148+ def __throw (self , txt = "#" , factor = 1.0 , num = 1 , trail = True ):
149+ """Throw move with trail effect
119150 ARGS:
120151 txt: The char that moves across the screen
121152 factor: Scalar to stretch the vector
122- num: The number of chars thrown"""
153+ num: The number of chars thrown
154+ trail: Whether to show a fading trail behind projectile"""
123155 if self .poke .enem == self .poke :
124156 return
125157 line = se .Line (
@@ -139,24 +171,36 @@ def throw(self, txt="#", factor=1.0, num=1):
139171 self .poke .ico .y + 1 ,
140172 )
141173 self .poke .ico .map .show ()
174+ trail_char = Color .white + "." + Color .reset
175+ trail_len = 3 if trail else 0
142176 for i in range (len (line .obs ) + num * 5 - 1 ):
143177 for j in range (0 , num * 5 , 5 ):
144178 if len (line .obs ) > i - j >= 0 :
145179 line .obs [i - j ].rechar (txt )
146- if len (line .obs ) >= i - j > 0 :
147- line .obs [i - j - 1 ].rechar (line .char )
180+ # Trail effect: show fading dots behind projectile
181+ if trail :
182+ for t in range (1 , trail_len + 1 ):
183+ trail_idx = i - j - t
184+ if 0 <= trail_idx < len (line .obs ):
185+ line .obs [trail_idx ].rechar (trail_char )
186+ # Clear old trail
187+ clear_idx = i - j - trail_len - 1 if trail else i - j - 1
188+ if len (line .obs ) > clear_idx >= 0 :
189+ line .obs [clear_idx ].rechar (line .char )
148190 time .sleep (SPEED_OF_TIME * 0.05 )
149191 self .poke .ico .map .show ()
150192 line .remove ()
151193 del line
152194
153195 def gun (self ):
154196 """Gun move"""
155- self .throw (txt = Color .thicc + Color .blue + "o" + Color .reset , num = 4 )
197+ self .__throw (txt = Color .thicc + Color .blue + "o" + Color .reset , num = 4 )
198+ self .impact ()
156199
157200 def fireball (self ):
158201 """Fireball move"""
159- self .throw (txt = Color .thicc + Color .red + "*" + Color .reset )
202+ self .__throw (txt = Color .thicc + Color .red + "*" + Color .reset )
203+ self .impact ()
160204
161205 def shine (self , ico = Color .thicc + Color .green + "*" + Color .reset ):
162206 """Shine Move"""
@@ -217,7 +261,7 @@ def rain(self):
217261 random .choice (range (2 )) + cloud .y + 3 ,
218262 )
219263 _map .show ()
220- time .sleep (0.05 )
264+ time .sleep (SPEED_OF_TIME * 0.05 )
221265 drops .append (rain )
222266 cloud .remove ()
223267 for drop in drops :
0 commit comments