Settings

Blockchain
Network
Unit
Language
Theme
Sound New Block

Transaction

7eab3835ff3694ee8cd2684f0fb7de2af26bdb4049082d93406c8920ab112c51
Timestamp (utc)
2021-04-17 09:24:23
Fee Paid
0.00011934 BSV
(
0.00994611 BSV
-
0.00982677 BSV
)
Fee Rate
502.9 sat/KB
Version
1
Confirmations
310,920
Size Stats
23,718 B

3 Outputs

Total Output:
0.00982677 BSV
  • jrun cryptofightsM¢[{"in":0,"ref":["be29c3020280aab0d478543cc1c80d41b4d3913399b21eddcd4f974b3fc6d469_o1","1e7dc1b5184c61c27d91ab737e40191c8d4497ba2025751abce9fe8cb7eca58d_o1","80a737b3b2e17c73ff26c1331d1e57c161d60c82f508b56e854acf0e32b49569_o1","b80281afbc3a80b726da0d10968da984f5fcbdb6584bdd12ec5e05809e590309_o1","f97d4ac2a3d6f5ed09fad4a4f341619dc5a3773d9844ff95c99c5d4f8388de2f_o1"],"out":["7f68a62c8cd4c75bda38407bbfb9d9e6ad7be986bd0f2343da3e3cee2f900639"],"del":[],"cre":["n2Bd4cWhEQK1aVjb1R7EBGV9mrw3etvSdC"],"exec":[{"op":"DEPLOY","data":["class Attack extends FyxClass {\n static run(battle, state, dice, timestamp, toHitBonus = 0, toDmgBonus = 0, attackType = Constants.SkillType.Attack) {\n const {Ability, DamageType, EquipSlot, ItemProperty, SkillType, StatusEffect, ItemType, Bonus} = Constants;\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];\n\n var mainhand = {...attackerItems[0]};\n if ((mainhand == null || mainhand.type == null) && attackerItems[1] == null) {\n\n mainhand = {};\n mainhand.properties = Object.keys(ItemProperty).map(() => false);\n\n if(attacker.fighter.skills.includes(SkillType.Unarmed)){\n mainhand.damageOutputs = [{\n type: DamageType.Bludgeoning,\n diceCount: 1,\n diceFaces: 8\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.abilityScoreRequired= 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 attackerItems[0] = mainhand;\n }\n\n let defenderState = state.fighterStates[state.playerToAct === 0 ? 1 : 0];\n let attackerState = state.fighterStates[state.playerToAct];\n\n const defenderPlayer = battle.battlePlayers[state.playerToAct ? 0 : 1];\n\n // Bob attacks Tim\n let resultMessage = `${playerName} attacks ${opponentName} : `; // goes up\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 attackActionLog = {\n actionLogMessage: log,\n playerIndex: state.playerToAct,\n skillType: attackType,\n results: []\n };\n\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 && !(multiattackImmune && i > 0)) {\n let weaponFlatBonuses = weapon.bonuses.slice(weapon.bonuses.length -10, weapon.bonuses.length);\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[7] > 0) {\n weaponFlatBonuses[weapon.damageOutputs[0].type] += weapon.bonuses[7];\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 + (attacker.fighter.skills.includes(SkillType.Precise) && weapon.properties[ItemProperty.Precision]) ? 1 : 0;\n\n if (attacker.fighter.skills.includes(SkillType.Ambidextrous) && attackerItems[EquipSlot.Mainhand] && attackerItems[EquipSlot.Offhand] && i === 0) {\n toHitBonus += 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 let result = this.makeResult(battle, state, dice, toHitAbility, toDmgAbility, toHitBonus, toDmgBonus, critChanceBonus, weapon.damageOutputs, defenderPlayer, resultMessage, attackType, weaponFlatBonuses);\n attackActionLog.results.push(result);\n\n if (weapon.properties[ItemProperty.Swift] && !multiattackImmune) {\n if (attackActionLog.results.length > 0) {\n if (attackActionLog.results.slice(-1).pop().damageOutput[0].defenderHp <= 0) {\n break;\n }\n }\n let result = this.makeResult(battle, state, dice, toHitAbility, toDmgAbility, toHitBonus, toDmgBonus, critChanceBonus, weapon.damageOutputs, defenderPlayer, resultMessage, attackType, weaponFlatBonuses);\n attackActionLog.results.push(result);\n }\n }\n }\n if (attackType === SkillType.Stun) {\n break;\n }\n }\n state.actionLogs.push(attackActionLog);\n }\n\n this.processPostAttackStatus(state, battle, attackerState, defenderState, attackType, defenderState.hp, dice, defenderPlayer);\n\n return BattleUtils.endTurn(battle, state, dice);\n }\n\n //Error: [ReferenceError: calculateFlatDamageBonuses is not defined]\n static calculateFlatDamageBonuses(weapon) {\n let flatBonuses = weapon.bonuses.slice(weapon.bonuses.length -10, weapon.bonuses.length);\n if (weapon.damageOutputs.length > 0 && weapon.bonuses[7] > 0) {\n flatBonuses[weapon.damageOutputs[0].type] += weapon.bonuses[7];\n }\n return flatBonuses;\n }\n\n static processPostAttackStatus(state, battle, attackerState, defenderState, attackType, defenderHp, dice, defenderPlayer) {\n const {Outcome, SkillType, StatusEffect} = Constants;\n let wasHit = false;\n let wasCrit = false;\n\n state.actionLogs.forEach(actionLog => {\n actionLog.results.forEach(result => {\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 // On Hit\n if (wasHit) {\n if (BattleUtils.isUnderStatusEffect(attackerState, StatusEffect.Poisonous, attackerState.turnCounter)) {\n BattleUtils.applyStatusEffect(state.actionLogs.slice(-1).pop(), battle, state, StatusEffect.Poisoned, 4, false);\n }\n\n if (attackType === SkillType.Stun || attackType === SkillType.Freeze) {\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 ? 3 : 1, 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 (defenderHp > 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, 1, '', 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 makeResult(battle, state, dice, toHitAbility, toDmgAbility, toHitBonus, toDmgBonus, critChanceBonus, weaponDamageOutputs, defenderPlayer, log, attackType = Constants.SkillType.Attack, weaponDmgBonus = []) {\n const {Ability, Outcome, RollType, SkillType, StatusEffect} = 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 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 more than ${defenderState.evasion} <sprite name=Dexterity-d20> to hit`;\n let damageMap = [0,0,0,0,0,0,0,0,0,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 for (let i = 0; i < weaponDmgBonus.length; i++) {\n damageMap[i] += weaponDmgBonus[i];\n }\n\n let result = BattleUtils.makeDamageResult(battle, state, defenderState, defenderPlayer, damageMap, rolls, outcome, preResultDescription);\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: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n defenderHp: defenderState.hp,\n defenderReduction: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]\n }],\n attackerStatusEffectsIncrement: attackerState.statusEffectsRound,\n hpIncrement: 0,\n attackerHp: attackerState.hp,\n preResultDescription: preResultDescription,\n resultMessage: log\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} = Constants;\n let savingThrows = [];\n\n if (BattleUtils.isUnderStatusEffect(spoteeState, StatusEffect.Hidden, spoteeState.turnCounter)) {\n var spoteeName = BattleUtils.getPrettifiedName(battle, spotterIndex);\n\n const attackerState = state.fighterStates[state.playerToAct];\n\n let savingThrow = dice.roll(1, 20);\n let attackerIntMod = spotterState.modifiers[Ability.Intelligence];\n let defenderEvasion = spoteeState.evasion;\n let rollResult = attackerIntMod + savingThrow;\n let outcome = rollResult >= defenderEvasion ?\n Outcome.Success : Outcome.Fail;\n\n savingThrows.push({\n type: RollType.Intelligence,\n ability: Ability.Intelligence,\n size: 20,\n value: savingThrow\n });\n\n if (outcome === Outcome.Success) { // found opponent\n spoteeState.statusEffectsRound[StatusEffect.Hidden] = 0;\n }\n\n return {\n playerIndex: spotterIndex,\n skillType: SkillType.Attack,\n results: [{\n rolls: savingThrows,\n outcome: outcome,\n damageOutput: [{\n damage: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n defenderHp: spoteeState.hp,\n defenderReduction: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n }],\n attackerStatusEffectsIncrement: spotterState.statusEffectsDurations,\n hpIncrement: 0,\n attackerHp: attackerState.hp\n }],\n actionLogMessage: `${spoteeName} <gradient=!log-color>Intelligence Save vs. Evasion : *${BattleUtils.parseSkillOutcome(outcome)}* (${savingThrow} + ${attackerIntMod} = ${rollResult} vs. DC ${defenderEvasion})`\n };\n }\n }\n}",{"affectsOpponent":true,"deps":{"BattleUtils":{"$jig":0},"Constants":{"$jig":1},"Dice":{"$jig":2},"FyxClass":{"$jig":3},"expect":{"$jig":4}},"description":"Attack Action","displayName":"Attack","handle":"attack","hash":"aea5cd2c659b7ce8a0e0e5b990b8e516a1739c14f90a97d5690657c8944cbc1e","isAttackAction":true,"requiredLevel":0,"skillType":0}]}]}
    https://whatsonchain.com/tx/7eab3835ff3694ee8cd2684f0fb7de2af26bdb4049082d93406c8920ab112c51