This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
watch: { | |
attackEffect(value, oldValue) | |
{ | |
// If the battleEffect has been reset and we've got another one waiting in our queue | |
if(value === false && this.attackEffectQueue.length > 0) | |
{ | |
// Show the effect from the queue | |
this.showAttackEffect(this.attackEffectQueue[0]); | |
// Remove the effect from the queue |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
showAttackEffect(effect) | |
{ | |
// If there's already an attack effect, queue it | |
if(this.attackEffect != false) | |
{ | |
this.attackEffectQueue.push(effect); | |
return; | |
} | |
// Show attack effect |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
attackEffect: false, | |
attackEffectQueue: [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if(attackPower > 0) | |
{ | |
// Show that the opponnet is receiving damage | |
Velocity(document.getElementById(this.otherPokemon+'-pokemon'), 'callout.swing'); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Show that the current pokemon is attacking | |
Velocity(document.getElementById(this.pokemonImageId), 'callout.pulse'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<transition appear name="pokemon-image"> | |
<img :id="pokemonImageId" v-if="alive" :src="image" class="pokemon-bottom"/> | |
</transition> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<style> | |
/* Setup enter animation */ | |
.pokemon-image-enter-active { | |
transition: all .5s ease; | |
} | |
/* Setup leave animation */ | |
.pokemon-image-leave-active { | |
transition: all .5s cubic-bezier(1.0, 0.5, 0.8, 1.0); | |
} | |
/* Enter effect */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
calculateDamage(attackName) { | |
const attack = this.local.pokemon.attacks[attackName]; | |
const damage = new Damage(attack, this.local.pokemon, this.opponent.pokemon); | |
return damage.power(); | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Damage from './Damage'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
power() { | |
return Math.floor(this.calculateStatsPower() * this.calculateStab() * this.calculateTypeEffect() * this.calculateCritical() * this.calculateOther() * this.getRandomFactor()) | |
} |