Settings

Blockchain
Network
Unit
Language
Theme
Sound New Block

Transaction

965637f388fa3575485f83ae01cfdb98fb78e2875641e7ffcd0352b2360eee22
Timestamp (utc)
2021-06-29 17:48:15
Fee Paid
0.00016594 BSV
(
0.00102859 BSV
-
0.00086265 BSV
)
Fee Rate
506.7 sat/KB
Version
1
Confirmations
291,623
Size Stats
32,738 B

3 Outputs

Total Output:
0.00086265 BSV
  • jrun cryptofightsMÞ~{"in":0,"ref":["67a8188238cffd278fa8881061cf8e0245aad0433e25f1e8ee2bf55a6b46c148_o1","5f50b89d572ee82e4e756bf2d3b66df920264c0dac58b45cc5473cd6d11809f9_o1","5334f688050535806987424ec00ba75b74a2087c8c3945765dd9107ac81af1a7_o1","9f0e192f744258c3484a1c19fa88ef68e46ee6cf75acc78cfe2ad5a0d2340d0e_o1","f97d4ac2a3d6f5ed09fad4a4f341619dc5a3773d9844ff95c99c5d4f8388de2f_o1"],"out":["c566f6f9fc9ae632139ac8f65541982941e7d90b96d6ccc9bf416516f17a77bc"],"del":[],"cre":["n2Bd4cWhEQK1aVjb1R7EBGV9mrw3etvSdC"],"exec":[{"op":"DEPLOY","data":["class Attack extends FyxClass {\n\n static getWeapons(battlePlayer)\n {\n const {Ability, DamageType, ItemProperty, ItemType, SkillType, Bonus} = Constants;\n var weapons = [];\n if ((battlePlayer.mainhand == null || battlePlayer.mainhand.type == null) && battlePlayer.offhand == null) {\n for (let index = 0; index < 2; index++) {\n var element = {};\n element.properties = Object.keys(ItemProperty).map(() => false);\n\n if(battlePlayer.fighter.skills.includes(SkillType.Unarmed)){\n element.damageOutputs = [{\n type: DamageType.Bludgeoning,\n diceCount: 2,\n diceFaces: 6\n }];\n element.properties[ItemProperty.Heavy] = true;\n }else{\n element.damageOutputs = [{\n type: DamageType.Bludgeoning,\n diceCount: 1,\n diceFaces: 4\n }];\n element.properties[ItemProperty.Light] = true;\n }\n element.properties[ItemProperty.Brutal] = true;\n element.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 element.displayName= 'Barefists';\n element.description= 'Pair of hands.';\n element.type= ItemType.Club;\n element.levelRequired= 1;\n element.abilityRequirements= Object.keys(Ability).map(()=> 1 );\n element.bonuses= Object.keys(Bonus).map(()=> 0 );\n element.damageBonus= Object.keys(DamageType).map(()=> 0 );\n element.damageReduction= Object.keys(DamageType).map(()=> 0 );\n element.quality= 1;\n weapons.push(element);\n }\n }\n else{\n if (battlePlayer.mainhand) {\n weapons.push(battlePlayer.mainhand);\n }\n if (battlePlayer.offhand) {\n weapons.push(battlePlayer.offhand);\n }\n }\n\n return weapons;\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 var attackItems = Attack.getWeapons(attacker);\n attackerItems[0] = attackItems[0];\n attackerItems[1] = attackItems[1];\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 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 && weapon.damageOutputs.length > 0 \n && (weapon.damageOutputs[0].type == DamageType.Piercing || weapon.damageOutputs[0].type == DamageType.Slashing)\n && weapon.properties[ItemProperty.Assault])) {\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.Fireball) {\n BattleUtils.applyStatusEffect(state.actionLogs.slice(-1).pop(), battle, state, StatusEffect.Burned, 3, 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.Heavy]))) {\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 && mainhand.properties[ItemProperty.Assault] && \n mainhand.damageOutputs && mainhand.damageOutputs !== null && mainhand.damageOutputs.length > 0 \n && (mainhand.damageOutputs[0].type == DamageType.Piercing || mainhand.damageOutputs[0].type == DamageType.Slashing))\n || (offHand && offhand.properties[ItemProperty.Assault] \n && offhand.damageOutputs && offhand.damageOutputs !== null && offhand.damageOutputs.length > 0 \n && (offhand.damageOutputs[0].type == DamageType.Piercing || 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 - critChanceBonus && !critImmune) {\n roll.totalBonus += critChanceBonus;\n outcome = Outcome.Critical;\n }\n }\n\n // *Hit* (10 + 1 + 1) = 12\n log += `*${BattleUtils.parseAttackOutcome(outcome)}* (${roll.value} + ${roll.bonusFromAbility} + ${roll.bonusFromSkill}${outcome == Outcome.Critical ?` +${critChanceBonus}` : ``} = ${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":"966ce21a9a8f32d55b22611bc7cc04562cdb9d6024476a0081d545a3472c7d9c","isAttackAction":true,"requiredLevel":0,"skillType":0}]}]}
    https://whatsonchain.com/tx/965637f388fa3575485f83ae01cfdb98fb78e2875641e7ffcd0352b2360eee22