Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- Pokémon Battle Turn-Based 0.0.0.2
- By Phoenix
- For Pokémon AZ Project (http://pastebin.com/zwkmqWXq)
- http://pastebin.com/u/nPhoenix
- (c) 2014
- */
- log = $("#battle_log");
- function damage(Lvl, Atk, Def, pow) {
- return (((((2 * Lvl) / 5 + 2) * pow * Atk) / Def) / 50 + 2) * (Math.random() * (1.0 - 0.85) + 0.85);;
- };
- me = {
- HP: 324,
- atk: 306,
- def: 229,
- spd: 329,
- Name: 'Raichu',
- Lv: 100
- };
- wild = {
- HP: 314,
- atk: 287,
- def: 240,
- spd: 322,
- Name: 'Raticate',
- Lv: 100
- };
- function battle_start() {
- log.html("Um " + wild.Name + " selvagem apareceu!");
- if (me.spd > wild.spd) {
- log.html(log.html() + "\n" + me.Name + " começa atacando!");
- my_turn(90);
- } else {
- log.html(log.html() + "\n" + wild.Name + " começa atacando!");
- wild_turn(80);
- };
- };
- function my_turn(pow) {
- console.log(wild.Name + " HP:" + wild.HP);
- wild.HP = wild.HP - damage(me.Lv, me.atk, wild.def, pow);
- log.html(log.html() + "\n" + me.Name + " usou Thunderbolt!");
- log.html(log.html() + "\n" + wild.Name + " HP:" + wild.HP);
- if (wild.HP <= 0) {
- log.html(log.html() + "\nO " + wild.Name + " selvagem desmaiou! \n");
- return false;
- };
- wild_turn(80);
- };
- function wild_turn(pow) {
- console.log(me.Name + " HP:" + me.HP);
- log.html(log.html() + "\n" + wild.Name + " usou Hyper Fang!");
- me.HP = me.HP - damage(wild.Lv, wild.atk, me.def, pow);
- log.html(log.html() + "\n" + me.Name + " HP:" + me.HP);
- if (me.HP <= 0) {
- log.html(log.html() + "\nSeu " + me.Name + " desmaiou! \n");
- return false;
- };
- my_turn(90);
- };
Advertisement
Add Comment
Please, Sign In to add comment