spellbook: ToggleInstantKill magic word

This commit is contained in:
Samuel T 2023-11-09 02:55:44 +00:00
parent 736ced4aec
commit ff220f7f5f
3 changed files with 18 additions and 1 deletions

View file

@ -74,7 +74,8 @@ class BattleCalculatorAI:
return (1, 95)
else:
return (0, 0)
if self.toonsAlwaysHit:
toon = self.battle.getToon(attackIndex)
if self.toonsAlwaysHit or toon.instantKillMode:
return (1, 95)
elif self.toonsAlwaysMiss:
return (0, 0)
@ -529,6 +530,9 @@ class BattleCalculatorAI:
if attackLevel == -1 and not atkTrack == FIRE:
result = LURE_SUCCEEDED
elif atkTrack != TRAP:
toon = self.battle.getToon(toonId)
if atkTrack != HEAL and toon.instantKillMode:
attackDamage = 32767
result = attackDamage
if atkTrack == HEAL:
if not self.__attackHasHit(attack, suit=0):

View file

@ -750,6 +750,15 @@ class SetMaxCarry(MagicWord):
toon.b_setMaxCarry(pouchSize)
return f"Set gag pouch size to {pouchSize} for {toon.getName()}"
class ToggleInstantKill(MagicWord):
aliases = ["instantkill", "instakill"]
desc = "Toggle the ability to instantly kill a Cog with any gag."
execLocation = MagicWordConfig.EXEC_LOC_SERVER
def handleWord(self, invoker, avId, toon, *args):
toon.setInstantKillMode(not toon.instantKillMode)
return f"Toggled instant-kill mode for {toon.getName()}"
class Fireworks(MagicWord):
aliases = ["firework"]

View file

@ -155,6 +155,7 @@ class DistributedToonAI(DistributedPlayerAI.DistributedPlayerAI, DistributedSmoo
self.savedCheesyExpireTime = 0
self.ghostMode = 0
self.immortalMode = 0
self.instantKillMode = 0
self.numPies = 0
self.pieType = 0
self._isGM = False
@ -2375,6 +2376,9 @@ class DistributedToonAI(DistributedPlayerAI.DistributedPlayerAI, DistributedSmoo
def setImmortalMode(self, flag):
self.immortalMode = flag
def setInstantKillMode(self, flag):
self.instantKillMode = flag
def b_setSpeedChatStyleIndex(self, index):
self.setSpeedChatStyleIndex(index)
self.d_setSpeedChatStyleIndex(index)