Transaction

54630ac058a610a4f59543694c1fc4e2296871aa387d5467088aaf481d88c172
( - )
177,226
2021-06-25 12:25:23
1
31,643 B

3 Outputs

Total Output:
  • jrun cryptofightsM–z{"in":0,"ref":["24da7c843b463f23e1e0cc9a73f4d95202b330194bcc100ee79edc90f78a0f8b_o1","5b259cd9534b3c87b7c205b7f7f62e490535f3b9aec97ae59d6289355b99df15_o1","5334f688050535806987424ec00ba75b74a2087c8c3945765dd9107ac81af1a7_o1","9f0e192f744258c3484a1c19fa88ef68e46ee6cf75acc78cfe2ad5a0d2340d0e_o1","f97d4ac2a3d6f5ed09fad4a4f341619dc5a3773d9844ff95c99c5d4f8388de2f_o1"],"out":["ff30d36fe762b1f3e80f8ba1623b08ccb437787f9054b00bf3f1a79c2c2c6b2a"],"del":[],"cre":["n2Bd4cWhEQK1aVjb1R7EBGV9mrw3etvSdC"],"exec":[{"op":"DEPLOY","data":["class Attack extends FyxClass {\n\n static getMainHand(battlePlayer)\n {\n const {Ability, DamageType, ItemProperty, ItemType, SkillType, Bonus} = Constants;\n var mainhand = battlePlayer.mainhand;\n\n if ((mainhand == null || mainhand.type == null) && battlePlayer.offhand == null) {\n\n mainhand = {};\n mainhand.properties = Object.keys(ItemProperty).map(() => false);\n\n if(battlePlayer.fighter.skills.includes(SkillType.Unarmed)){\n mainhand.damageOutputs = [{\n type: DamageType.Bludgeoning,\n diceCount: 2,\n diceFaces: 6\n }];\n mainhand.properties[ItemProperty.Swift] = true;\n }else{\n mainhand.damageOutputs = [{\n type: DamageType.Bludgeoning,\n diceCount: 1,\n diceFaces: 4\n }];\n }\n mainhand.properties[ItemProperty.Heavy] = true;\n mainhand.properties[ItemProperty.Brutal] = true;\n mainhand.properties[ItemProperty.Assault] = true;\n\n expect(ItemType).toBeDefined('ItemType is null');\n expect(Bonus).toBeDefined('ItemBonus is null');\n expect(DamageType).toBeDefined('DamageType is null');\n\n mainhand.displayName= 'Barefists';\n mainhand.description= 'Pair of hands.';\n mainhand.type= ItemType.Club;\n mainhand.levelRequired= 1;\n mainhand.abilityRequirements= Object.keys(Ability).map(()=> 1 );\n mainhand.bonuses= Object.keys(Bonus).map(()=> 0 );\n mainhand.damageBonus= Object.keys(DamageType).map(()=> 0 );\n mainhand.damageReduction= Object.keys(DamageType).map(()=> 0 );\n mainhand.quality= 1;\n }\n\n return mainhand;\n }\n\n static run(battle, state, dice, timestamp, toHitBonus = 0, toDmgBonus = 0, attackType = Constants.SkillType.Attack, cooldown = -1) {\n const {Ability, DamageType, EquipSlot, ItemProperty, SkillType, StatusEffect, Bonus} = Constants;\n\n const skillIndex = battle.battlePlayers[state.playerToAct].skills.findIndex( x=> x.skillType == attackType);\n const cooldownTurns = state.fighterStates[state.playerToAct].actionCooldownsRound[skillIndex];\n if(cooldownTurns > state.fighterStates[state.playerToAct].turnCounter){\n return BattleUtils.skipTurn(battle, state, dice);\n }\n\n let playerName = BattleUtils.getPrettifiedPlayerName(battle, state);\n let opponentName = BattleUtils.getOpponentName(battle, state);\n let log = `${playerName} uses <sprite name=\"${BattleUtils.parseSkillName(attackType)}\">${BattleUtils.parseSkillName(attackType)}\\n`;\n\n const attacker = battle.battlePlayers[state.playerToAct];\n const attackerItems = [battle.battlePlayers[state.playerToAct].mainhand, battle.battlePlayers[state.playerToAct].offhand, battle.battlePlayers[state.playerToAct].armor, battle.battlePlayers[state.playerToAct].hat];\n\n attackerItems[0] = Attack.getMainHand(attacker);\n\n let attackerState = state.fighterStates[state.playerToAct];\n let defenderState = state.fighterStates[state.playerToAct === 0 ? 1 : 0];\n const defenderPlayer = battle.battlePlayers[state.playerToAct ? 0 : 1];\n\n // Bob attacks Tim\n let resultMessage = `${playerName} attacks ${opponentName} : `; // goes up\n let attackActionLog = {\n actionLogMessage: log,\n playerIndex: state.playerToAct,\n skillType: attackType,\n results: []\n };\n \n // Process pre-attack saving throws actionLogs\n if (BattleUtils.isUnderStatusEffect(defenderState, StatusEffect.Hidden, defenderState.turnCounter)) { // Spot\n state.actionLogs.push(this.makeSpotActionLog(battle, state, dice, attackerState, defenderState, state.playerToAct));\n }\n \n if (!BattleUtils.isUnderStatusEffect(defenderState, StatusEffect.Hidden, defenderState.turnCounter)) {\n \n let totalHitBonus = 0;\n const attackerStr = attacker.fighter.abilityScores[Ability.Strength];\n const attackerDex = attacker.fighter.abilityScores[Ability.Dexterity];\n const derivedStats = BattleUtils.getDerivedStats(attacker.fighter, attackerItems);\n\n for (var i = 0; i < 2; i++) {\n let weapon = attackerItems[i];\n let multiattackImmune = BattleUtils.isUnderStatusEffect(defenderState, StatusEffect.Meditative, defenderState.turnCounter);\n\n if (weapon && weapon.type !== null) {\n if (!(multiattackImmune && i > 0)) {\n let weaponFlatBonuses = [weapon.bonuses[Bonus.Piercing],weapon.bonuses[Bonus.Slashing],weapon.bonuses[Bonus.Bludgeoning],\n weapon.bonuses[Bonus.Fire],weapon.bonuses[Bonus.Cold],weapon.bonuses[Bonus.Necrotic],weapon.bonuses[Bonus.Lightning],weapon.bonuses[Bonus.Poison],\n weapon.bonuses[Bonus.Mystic], weapon.bonuses[Bonus.Warfare]];\n if (weapon.damageOutputs !== null) {\n if(attacker.fighter.skills.includes(SkillType.Warmongering)){\n weapon.damageOutputs[0].type = DamageType.Warfare;\n }\n if (weapon.damageOutputs.length > 0 && weapon.bonuses[Bonus.BaseDamage] > 0) {\n weaponFlatBonuses[weapon.damageOutputs[0].type] += weapon.bonuses[Bonus.BaseDamage];\n }\n }\n // Find out 'to hit' ability\n var toHitAbility = Ability.Intelligence;\n // Weapon is brutal or ambivalent + player has str > dex\n if (weapon.properties[ItemProperty.Brutal] || (weapon.properties[ItemProperty.Ambivalent] && attackerStr >= attackerDex)) {\n toHitAbility = Ability.Strength;\n } else {\n // Weapon is dextrous or ambivalent + player has dex > str\n if (weapon.properties[ItemProperty.Dextrous] || (weapon.properties[ItemProperty.Ambivalent] && attackerDex >= attackerStr)) {\n toHitAbility = Ability.Dexterity;\n }\n }\n\n // Find out 'to damage' ability\n let toDmgAbility = Ability.Intelligence;\n // Weapon is Assault\n if (weapon.properties[ItemProperty.Assault]) {\n toDmgAbility = Ability.Strength;\n } else {\n // Weapon is Precision\n if (weapon.properties[ItemProperty.Precision]) {\n toDmgAbility = Ability.Dexterity;\n }\n }\n \n if (weapon.damageOutputs.length > 0) {\n expect(Constants.DamageTypeNames[weapon.damageOutputs[0].type]).toBeDefined(`Weapon with unknown damage type while processing attack, ${weapon.damageOutputs[0].type} not in ${JSON.stringify(Constants.DamageTypeNames)}`);\n \n // We also need to grab any crit chance bonus from weapons\n var critChanceBonus = derivedStats.critChance; //moving this to BattleUtils.getDerivedStats (we might need change if we add offhand precising weapons) + (attacker.fighter.skills.includes(SkillType.Precise) && weapon.properties[ItemProperty.Precision]) ? 1 : 0;\n\n totalHitBonus = toHitBonus;\n\n if(i === 0)\n {\n totalHitBonus += 2;\n } \n else if( i === 1 && attackerItems[EquipSlot.Offhand].properties[ItemProperty.Light])\n {\n totalHitBonus += 2;\n }\n\n if (attacker.fighter.skills.includes(SkillType.Ambidextrous)) {\n totalHitBonus += 2;\n }\n\n if (attackActionLog.results.length > 0) {\n if (attackActionLog.results.slice(-1).pop().damageOutput[0].defenderHp <= 0) {\n break;\n }\n }\n\n if (weapon.properties[ItemProperty.Loading] && !attackerState.areLoaded[ i ]) {\n attackerState.areLoaded[ i ] = true;\n let result = this.makeLoadingResult(state, weapon.type);\n attackActionLog.results.push(result);\n }\n else\n {\n if (attackType == SkillType.Stab && !(weapon.damageOutputs && weapon.damageOutputs !== null \n && weapon.damageOutputs.length > 0 && weapon.damageOutputs[0].type == DamageType.Slashing)) {\n continue;\n }\n let result = this.makeResult(battle, state, dice, toHitAbility, toDmgAbility, totalHitBonus, toDmgBonus, critChanceBonus, weapon.damageOutputs, defenderPlayer, resultMessage, attackType, weaponFlatBonuses, i);\n attackActionLog.results.push(result);\n attackerState.areLoaded[ i ] = false;\n }\n\n if ((weapon.properties[ItemProperty.Swift] || (weapon.properties[ItemProperty.Light] && attackType == SkillType.Strike)\n || BattleUtils.isUnderStatusEffect(attackerState, StatusEffect.Swifted, attackerState.turnCounter)) && !multiattackImmune) {\n if (attackActionLog.results.length > 0) {\n if (attackActionLog.results.slice(-1).pop().damageOutput[0].defenderHp <= 0) {\n break;\n }\n }\n if (weapon.properties[ItemProperty.Loading] && !attackerState.areLoaded[ i ]) {\n attackerState.areLoaded[ i ] = true;\n let result = this.makeLoadingResult(state, weapon.type);\n attackActionLog.results.push(result);\n }\n else\n {\n let result = this.makeResult(battle, state, dice, toHitAbility, toDmgAbility, totalHitBonus, toDmgBonus, critChanceBonus, weapon.damageOutputs, defenderPlayer, resultMessage, attackType, weaponFlatBonuses, i);\n attackActionLog.results.push(result);\n attackerState.areLoaded[ i ] = false;\n }\n }\n }\n }\n }\n if (attackType === SkillType.Stun) {\n break;\n }\n }\n }\n else\n {\n for (var i = 0; i < 2; i++) {\n let weapon = attackerItems[i];\n if (weapon && weapon.type !== null) {\n if (weapon.properties[ItemProperty.Loading] && !attackerState.areLoaded[ i ]) {\n attackerState.areLoaded[ i ] = true;\n let result = this.makeLoadingResult(state, weapon.type);\n attackActionLog.results.push(result);\n }\n }\n }\n }\n\n state.actionLogs.push(attackActionLog);\n this.processPostAttackStatus(state, battle, attackType);\n BattleUtils.applySkillCooldown(battle, state, attackType, cooldown);\n \n return BattleUtils.endTurn(battle, state, dice);\n }\n\n static processPostAttackStatus(state, battle, attackType) {\n const {Outcome, RollType, SkillType, StatusEffect, DamageType, ItemProperty} = Constants;\n let wasHit = false;\n let wasCrit = false;\n let attackerState = state.fighterStates[state.playerToAct];\n let defenderState = state.fighterStates[state.playerToAct === 0 ? 1 : 0];\n let attackerPlayer = battle.battlePlayers[state.playerToAct];\n let defenderPlayer = battle.battlePlayers[state.playerToAct ? 0 : 1];\n\n let weapons = [];\n let mainhand = attackerPlayer.mainhand;\n let mainHand = false;\n if (mainhand && mainhand !== null) {\n if (mainhand.properties && mainhand.properties !== null) {\n mainHand = true;\n weapons.push(mainhand);\n }\n }\n let offhand = attackerPlayer.offhand;\n let offHand = false;\n if (offhand && offhand !== null) {\n if (offhand.properties && offhand.properties !== null) {\n offHand = true;\n weapons.push(offhand);\n }\n }\n \n state.actionLogs.forEach(actionLog => {\n if (actionLog.skillType === attackType) {\n actionLog.results.forEach(result => {\n result.rolls.forEach(roll => {\n if (roll.type == RollType.ToHit) {\n if (result.outcome === Outcome.Success || result.outcome === Outcome.Critical) {\n wasHit = true;\n }\n if (result.outcome === Outcome.Critical) {\n wasCrit = true;\n }\n }\n });\n });\n }\n });\n \n // On Hit\n if (wasHit) {\n if(attackType === SkillType.SneakAttack && attackerPlayer.fighter.skills.includes(SkillType.ImprovedSneakAttack))\n {\n BattleUtils.applyStatusEffect(state.actionLogs.slice(-1).pop(), battle, state, StatusEffect.Poisoned, 1, false);\n }\n\n if (BattleUtils.isUnderStatusEffect(attackerState, StatusEffect.Poisonous, attackerState.turnCounter)) {\n BattleUtils.applyStatusEffect(state.actionLogs.slice(-1).pop(), battle, state, StatusEffect.Poisoned, 6, false);\n }\n\n if (attackType === SkillType.Stun &&\n ((attackerPlayer.fighter.skills.includes(SkillType.Unarmed) && weapons.length == 0) ||\n (mainHand && attackerPlayer.mainhand.properties !== null \n && attackerPlayer.mainhand.properties[ItemProperty.Brutal] && attackerPlayer.mainhand.properties[ItemProperty.Brutal]))) {\n BattleUtils.applyStatusEffect(state.actionLogs.slice(-1).pop(), battle, state, StatusEffect.Stunned, 2, false);\n }\n\n if (attackType === SkillType.Freeze\n || (attackType === SkillType.Stab && ((mainHand\n && attackerPlayer.mainhand.damageOutputs && attackerPlayer.mainhand.damageOutputs !== null \n && attackerPlayer.mainhand.damageOutputs.length > 0 && attackerPlayer.mainhand.damageOutputs[0].type == DamageType.Slashing)\n || (offHand && attackerPlayer.offhand.damageOutputs && attackerPlayer.offhand.damageOutputs !== null \n && attackerPlayer.offhand.damageOutputs.length > 0 && attackerPlayer.offhand.damageOutputs[0].type == DamageType.Slashing)))) {\n BattleUtils.applyStatusEffect(state.actionLogs.slice(-1).pop(), battle, state, StatusEffect.Stunned, 1, false);\n }\n\n if (attackType === SkillType.Chill) {\n BattleUtils.applyStatusEffect(state.actionLogs.slice(-1).pop(), battle, state, StatusEffect.Demoralized, 2, false);\n }\n if (attackType === SkillType.PinningStrike && wasCrit) {\n BattleUtils.applyStatusEffect(state.actionLogs.slice(-1).pop(), battle, state, StatusEffect.Stunned, 2, false);\n }\n }\n if (attackType === SkillType.PinningStrike) {\n BattleUtils.applyStatusEffect(state.actionLogs.slice(-1).pop(), battle, state, StatusEffect.Marked, wasCrit ? 4 : 2, false);\n }\n\n // On Attack\n if (attackType === SkillType.Gore) {\n BattleUtils.applyStatusEffect(state.actionLogs.slice(-1).pop(), battle, state, StatusEffect.Demoralized, 1, true);\n }\n\n if (attackType === SkillType.LockAndLoad) {\n BattleUtils.applyStatusEffect(state.actionLogs.slice(-1).pop(), battle, state, StatusEffect.Demoralized, 3, false);\n BattleUtils.applyStatusEffect(state.actionLogs.slice(-1).pop(), battle, state, StatusEffect.Inspired, 3, true);\n }\n if (defenderState.hp > 0) {\n if (BattleUtils.isUnderStatusEffect(attackerState, StatusEffect.Hidden, attackerState.turnCounter)) {\n //state.actionLogs.push(this.makeSpotActionLog(battle, state, dice, defenderState, attackerState, state.playerToAct ? 0 : 1));\n }\n\n if (defenderPlayer.fighter.skills.includes(SkillType.Vengeful) && wasHit) {\n state.actionLogs.push(BattleUtils.makeStatusEffectActionLog(battle, state, SkillType.Vengeful, StatusEffect.Cursed, 0, '', true));\n }\n\n if (defenderPlayer.fighter.skills.includes(SkillType.Opportunistic) && !wasHit) {\n state.actionLogs.push(BattleUtils.makeStatusEffectActionLog(battle, state, SkillType.Opportunistic, StatusEffect.Inspired, 1, '', false));\n }\n }\n }\n\n static makeLoadingResult(state, weaponType)\n { \n const {Outcome, ItemTypeNames, DamageType, StatusEffect} = Constants;\n const defenderState = state.fighterStates[state.playerToAct ? 0 : 1];\n const attackerState = state.fighterStates[state.playerToAct];\n const damageMap = Object.keys(DamageType).map(() => 0);\n return {\n rolls: [],\n outcome: Outcome.Success,\n damageOutput: [{\n damage: damageMap,\n defenderHp: defenderState.hp,\n defenderReduction: damageMap\n }],\n attackerStatusEffectsIncrement: Object.keys(StatusEffect).map(() => 0),\n hpIncrement: 0,\n attackerHp: attackerState.hp,\n resultMessage: `${ItemTypeNames[weaponType]} is loading\\n`\n };\n }\n\n static makeResult(battle, state, dice, toHitAbility, toDmgAbility, toHitBonus, toDmgBonus, critChanceBonus, weaponDamageOutputs, defenderPlayer, log, attackType = Constants.SkillType.Attack, weaponDmgBonus = [], weaponIndex) {\n const {Ability, Outcome, RollType, SkillType, StatusEffect, ItemProperty, DamageType} = Constants;\n const defenderState = state.fighterStates[state.playerToAct ? 0 : 1];\n const attackerState = state.fighterStates[state.playerToAct];\n const attacker = battle.battlePlayers[state.playerToAct];\n\n /* #region attack_roll */\n let roll = {\n type: RollType.ToHit,\n ability: toHitAbility,\n size: 20,\n value: dice.roll(1, 20)\n };\n var rolls = [roll];\n\n // Advantage\n if (BattleUtils.isUnderStatusEffect(attackerState, StatusEffect.Hidden, attackerState.turnCounter) ||\n BattleUtils.isUnderStatusEffect(attackerState, StatusEffect.Inspired, attackerState.turnCounter) ||\n BattleUtils.isUnderStatusEffect(defenderState, StatusEffect.Marked, attackerState.turnCounter)) {\n rolls.push({\n type: RollType.ToHit,\n ability: toHitAbility,\n size: 20,\n value: dice.roll(1, 20)\n });\n\n if (rolls.slice(-1).pop().value > roll.value) {\n roll.discarded = true;\n roll = rolls.slice(-1).pop();\n } else {\n rolls.slice(-1).pop().discarded = true;\n }\n }\n\n if (BattleUtils.isUnderStatusEffect(attackerState, StatusEffect.Demoralized, attackerState.turnCounter)) {\n rolls.push({\n type: RollType.ToHit,\n ability: toHitAbility,\n size: 20,\n value: dice.roll(1, 20)\n });\n\n if (rolls.slice(-1).pop().value < roll.value) {\n roll.discarded = true;\n roll = rolls.slice(-1).pop();\n } else {\n rolls.slice(-1).pop().discarded = true;\n }\n }\n /* #endregion */\n\n // Process bonuses for selected dice\n roll.bonusFromAbility = attackerState.modifiers[toHitAbility];\n let skill = attacker.skills.find( x => x.skillType == attackType);\n if ((!attacker.mainhand || attacker.mainhand.properties[ItemProperty.Innocuous]) \n && (!attacker.offhand|| attacker.offhand.properties[ItemProperty.Innocuous]) && skill && skill.isSpellAction) {\n toHitBonus += 2;\n }\n roll.bonusFromSkill = toHitBonus;\n roll.totalBonus = roll.bonusFromAbility + roll.bonusFromSkill;\n\n let outcome = Outcome.Fail;\n if (roll.value + roll.totalBonus >= defenderState.evasion) {\n outcome = Outcome.Success;\n let critImmune = BattleUtils.isUnderStatusEffect(defenderState, StatusEffect.Meditative, defenderState.turnCounter);\n if (roll.value > 20 - (attackerState.critChance + critChanceBonus) && !critImmune) {\n outcome = Outcome.Critical;\n }\n }\n\n // *Hit* (10 + 1 + 1) = 12\n log += `*${BattleUtils.parseAttackOutcome(outcome)}* (${roll.value} + ${roll.bonusFromAbility} + ${roll.bonusFromSkill} = ${roll.value + roll.totalBonus})\\n`;\n\n let preResultDescription = `You need at least ${defenderState.evasion} <sprite name=Dexterity-d20> to hit`;\n let damageMap = Object.keys(DamageType).map(() => 0);\n\n if (outcome !== Outcome.Fail) {\n if (attackType !== SkillType.Stun && attackType !== SkillType.PinningStrike) {\n for (let i = 0; i < weaponDamageOutputs.length; i++) {\n var damageRoll = BattleUtils.rollDmgDice(toDmgAbility, weaponDamageOutputs[i].diceCount, weaponDamageOutputs[i].diceFaces, dice, rolls, RollType.ToDamage);\n damageMap[weaponDamageOutputs[i].type] += damageRoll;\n if (attackType === SkillType.Gore) {\n toDmgBonus += damageRoll;\n damageMap[weaponDamageOutputs[i].type] += damageRoll;\n }\n }\n } else {\n rolls.push({\n type: RollType.ToDamage,\n ability: toDmgAbility,\n size: 0,\n value: 0\n });\n }\n\n // Process to dmg bonuses\n roll = rolls.slice(-1).pop();\n roll.bonusFromAbility = attackerState.modifiers[toDmgAbility];\n roll.bonusFromSkill = toDmgBonus;\n roll.totalBonus = roll.bonusFromSkill;\n if (!attacker.fighter.skills.includes(SkillType.Cirurgical)) {\n roll.totalBonus += roll.bonusFromAbility;\n }\n damageMap[weaponDamageOutputs[0].type] += roll.totalBonus;\n if (attackType === SkillType.DirtyFighting) {\n let dirtyRoll = dice.roll(1, 4);\n rolls.push({\n type: RollType.ToDamage,\n ability: toHitAbility,\n size: 4,\n value: dirtyRoll\n });\n damageMap[weaponDamageOutputs[0].type] += dirtyRoll;\n }\n if (attackType === SkillType.SneakAttack) {\n let isImproved = attacker.fighter.skills.includes(SkillType.ImprovedSneakAttack);\n let sneakRoll = dice.roll(1, isImproved ? 8 : 6);\n rolls.push({\n type: RollType.ToDamage,\n ability: toHitAbility,\n size: isImproved ? 8 : 6,\n value: sneakRoll\n });\n damageMap[weaponDamageOutputs[0].type] += sneakRoll;\n }\n if (outcome === Outcome.Critical && attackType !== SkillType.DirtyFighting) {\n damageMap[weaponDamageOutputs[0].type] += BattleUtils.rollDmgDice(toDmgAbility, weaponDamageOutputs[0].diceCount, weaponDamageOutputs[0].diceFaces, dice, rolls, RollType.WeaponCrit);\n // Roll a die with the same number of faces as\n // the fighter's dexterity modifier rounded up to nearest even number\n let critModifier = attackerState.modifiers[Ability.Dexterity];\n if (attackType === SkillType.LightningBolt) {\n critModifier += attackerState.modifiers[Ability.Intelligence];\n }\n if (attackType === SkillType.Shock) {\n critModifier += 1;\n }\n if (critModifier > 0) {\n let faces = critModifier % 2 === 0 ? critModifier : critModifier + 1;\n let fighterCritNativeRoll = dice.roll(1, faces);\n rolls.push({\n type: RollType.FighterCrit,\n ability: Ability.Dexterity,\n size: faces,\n value: fighterCritNativeRoll\n });\n damageMap[weaponDamageOutputs[0].type] += fighterCritNativeRoll;\n }\n }\n\n for (let i = 0; i < damageMap.length; i++) { \n if (damageMap[i] < 0) {\n damageMap[i] = 0;\n } \n }\n\n if (weaponDmgBonus && weaponDmgBonus !== null) {\n for (let i = 0; i < weaponDmgBonus.length; i++) {\n damageMap[i] += weaponDmgBonus[i];\n }\n }\n\n let result = BattleUtils.makeDamageResult(battle, state, defenderState, defenderPlayer, damageMap, rolls, outcome, preResultDescription);\n result.weaponIndex = weaponIndex;\n log += result.resultMessage;\n result.resultMessage = log;\n return result;\n } else {\n return {\n rolls: rolls,\n outcome: outcome,\n damageOutput: [{\n damage: Object.keys(DamageType).map(() => 0),\n defenderHp: defenderState.hp,\n defenderReduction: Object.keys(DamageType).map(() => 0)\n }],\n attackerStatusEffectsIncrement: attackerState.statusEffectsRound,\n hpIncrement: 0,\n attackerHp: attackerState.hp,\n preResultDescription: preResultDescription,\n resultMessage: log,\n weaponIndex: weaponIndex\n };\n }\n }\n\n // Abstract this out to a saving throw\n static makeSpotActionLog(battle, state, dice, spotterState, spoteeState, spotterIndex) {\n const {Ability, Outcome, RollType, SkillType, StatusEffect, DamageType} = Constants;\n let savingThrows = [];\n\n if (BattleUtils.isUnderStatusEffect(spoteeState, StatusEffect.Hidden, spoteeState.turnCounter)) {\n\n var spoteeName = BattleUtils.getPrettifiedName(battle, spotterIndex);\n const attackerState = state.fighterStates[state.playerToAct];\n const defenderState = state.fighterStates[state.playerToAct ? 0 : 1];\n\n let savingThrow = dice.roll(1, 20);\n let attackerIntMod = spotterState.modifiers[Ability.Intelligence];\n let rollType = spoteeState.evasion > defenderState.modifiers[Ability.Intelligence] + 10;\n let dc = rollType ? defenderState.modifiers[Ability.Intelligence] + 10 : spoteeState.evasion;\n let rollResult = attackerIntMod + savingThrow;\n let outcome = rollResult >= dc ? Outcome.Success : Outcome.Fail;\n\n savingThrows.push({\n type: rollType ? RollType.Intelligence : RollType.Dexterity,\n ability: rollType ? Ability.Intelligence : Ability.Dexterity,\n size: 20,\n value: savingThrow\n });\n\n if (outcome === Outcome.Success) { // found opponent\n spoteeState.statusEffectsRound[StatusEffect.Hidden] = 0;\n }\n const damageMap = Object.keys(DamageType).map(() => 0);\n return {\n playerIndex: spotterIndex,\n skillType: SkillType.Attack,\n results: [{\n rolls: savingThrows,\n outcome: outcome,\n damageOutput: [{\n damage: damageMap,\n defenderHp: spoteeState.hp,\n defenderReduction: damageMap,\n }],\n attackerStatusEffectsIncrement: spotterState.statusEffectsRound,\n hpIncrement: 0,\n attackerHp: attackerState.hp\n }],\n actionLogMessage: `${spoteeName} <gradient=!log-color>Intelligence Save vs. ${rollType ? \"Perception\" : \"Evasion\"} : *${BattleUtils.parseSkillOutcome(outcome)}* (${savingThrow} + ${attackerIntMod} = ${rollResult} vs. DC ${dc})`\n };\n }\n }\n}",{"affectsOpponent":true,"cooldown":0,"deps":{"BattleUtils":{"$jig":0},"Constants":{"$jig":1},"Dice":{"$jig":2},"FyxClass":{"$jig":3},"expect":{"$jig":4}},"description":"Attack Action","displayName":"Attack","handle":"attack","hash":"bbb23c2f03c4ddb1a950b0b9b5b2b816134d6be9be49d2dcc04d57d6b705231a","isAttackAction":true,"requiredLevel":0,"skillType":0}]}]}
    https://whatsonchain.com/tx/54630ac058a610a4f59543694c1fc4e2296871aa387d5467088aaf481d88c172