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

View file

@ -751,6 +751,15 @@ class SetMaxCarry(MagicWord):
toon.b_setMaxCarry(pouchSize) toon.b_setMaxCarry(pouchSize)
return f"Set gag pouch size to {pouchSize} for {toon.getName()}" 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): class Fireworks(MagicWord):
aliases = ["firework"] aliases = ["firework"]
desc = "Starts a firework show." desc = "Starts a firework show."

View file

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