-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfight_script.rpy
162 lines (115 loc) · 6.19 KB
/
fight_script.rpy
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
label move_attack(fight, target, attacker, move, move_damage):
$ fight.stats[attacker]["damage_dealt"] += move_damage
$ fight.stats[target]["damage_blocked"] += max(move_damage - target.current_guard, 0)
if move_damage > target.current_guard and target.current_guard <= 0 and not attacker.stance_bonus == "Jab":
$ fight.stats[attacker]["guards_broken"] += 1
# Quirk: Backlash
if isinstance(target.quirk, Backlash):
$ attacker.current_health -= 3
if target.current_guard < move_damage or attacker.stance_bonus == "Jab":
scene expression move.images["hit_image"]
with vpunch
$ target.current_health -= (damage - target.current_guard)
$ target.current_guard = 0
else:
scene expression move.images["blocked_image"]
with vpunch
$ target.current_guard -= move.damage
pause 1.0
return
label fight_start_turn(fight, target, attacker):
hide screen phone_icon
scene black
if attacker == fight.player:
show text "{size=100}Your Turn{/size}"
else:
show text "{size=100}Opponent's turn{/size}"
pause 1.0
$ overwhelmed_multiplier = 1
if attacker == fight.opponent:
# Overwhelmed
if len(fight.move_list[-1][target]) >= 4:
if attacker.current_health / float(attacker.max_health) <= 0.25:
$ overwhelmed_multiplier = 1.9
elif 0.25 < attacker.current_health / float(attacker.max_health) <= 0.5:
$ overwhelmed_multiplier = 1.6
else:
$ overwhelmed_multiplier = 1.3
$ attacker.current_guard = round(attacker.stance.value * overwhelmed_multiplier)
if isinstance(target.stance_bonus, Hook):
$ attacker.current_stamina -= 2
$ fight.move_list.append({attacker: []})
if attacker == fight.player:
call screen fight_player_turn(fight, attacker, target)
else:
call fight_attack_turn(fight, target, attacker) from _call_fight_attack_turn
label fight_attack_turn(fight, target, attacker, move=None):
$ renpy.set_return_stack([])
show screen health_bars(fight.player, fight.opponent)
if move is None:
if attacker.special_attack is not None and attacker.special_attack.is_sensitive(fight, target, attacker) and attacker.current_stamina >= attacker.special_attack.stamina_cost:
$ move = attacker.special_attack
elif any(move.ideal_stance == attacker.stance and move.stamina_cost <= attacker.current_stamina for move in attacker.base_attacks):
$ move = renpy.random.choice(list(filter(lambda move: move.ideal_stance == attacker.stance and move.stamina_cost <= attacker.current_stamina, attacker.base_attacks)))
else:
$ move = renpy.random.choice(list(filter(lambda move: move.stamina_cost <= attacker.current_stamina, attacker.base_attacks + attacker.turn_moves)))
if not fight.move_list:
$ fight.move_list.append({attacker: []})
$ fight.move_list[-1][attacker].append(move)
if move == end_turn or isinstance(move, EndTurn):
$ attacker.current_stamina = attacker.max_stamina + min(attacker.current_stamina, 2)
$ attacker.current_guard = attacker.stance.value
call fight_start_turn(fight, attacker, target) from _call_fight_start_turn
elif move == turtle or isinstance(move, Turtle):
$ attacker.current_guard = FightStance.DEFENSIVE.value
# Stance Bonus
if attacker.stance == FightStance.SOLID:
$ attacker.current_guard += 1
call fight_start_turn(fight, attacker, target) from _call_fight_start_turn_1
if hasattr(move, "images") and not move.images:
$ raise NotImplementedError("Move {} is missing images.".format(move.name))
$ attacker.current_stamina -= move.stamina_cost
scene expression move.images["start_image"]
pause 1.0
# Player attacks
# Opponent Approachs
$ primed_multiplier = FightService.get_primed_multiplier(target, fight, move)
$ reckless_multiplier = FightService.get_reckless_multiplier(target, fight)
if attacker == fight.player:
# Calculating
$ attacker.current_health -= round(move.damage * FightService.get_calculating_multiplier(target, fight))
# Stance Bonus
$ stance_multiplier = FightService.get_stance_multiplier(target, fight)
# Quirk: The Great Equalizer
$ the_great_equalizer_multiplier = attacker.quirk.effect(attacker, target, move) if isinstance(attacker.quirk, TheGreatEqualizer) else 1.0
# Quirk: In The Zone
$ in_the_zone_multiplier = attacker.quirk.effect(attacker, target, move) if isinstance(attacker.quirk, InTheZone) else 1.0
# Quirk: Double Time
$ double_time_multiplier = 2.0 if isinstance(attacker.quirk, DoubleTime) or isinstance(target.quirk, DoubleTime) else 1.0
# Quirk: All In
$ all_in_multiplier = 2.0 if isinstance(attacker.quirk, DoubleTime) or isinstance(target.quirk, DoubleTime) else 1.0
$ damage = round(move.damage * primed_multiplier * reckless_multiplier * stance_multiplier * the_great_equalizer_multiplier * in_the_zone_multiplier * double_time_multiplier * all_in_multiplier)
# Seeing Red quirk
if isinstance(attacker.quirk, SeeingRed) and not fight.move_list[-1][attacker]:
$ damage *= 2
call move_attack(fight, target, attacker, move, damage) from _call_move_attack
if target.current_health <= 0:
hide screen health_bars
show screen phone_icon
jump expression fight.end_label
# Set end stance
if move.end_stance is not None:
$ attacker.stance = move.end_stance
if attacker.current_stamina > 0:
if attacker == fight.player:
call screen fight_player_turn(fight, fight.player, fight.opponent)
else:
call fight_attack_turn(fight, target, attacker) from _call_fight_attack_turn_1
else:
# Seeing Red quirk
if isinstance(attacker.quirk, SeeingRed) and attacker.stance == FightStance.AGGRESSIVE:
$ attacker.current_guard = 0
else:
$ attacker.current_guard = attacker.stance.value
$ attacker.current_stamina = attacker.max_stamina
call fight_start_turn(fight, attacker, target) from _call_fight_start_turn_2