File size: 2,872 Bytes
5c2ed06
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
'use strict';

const assert = require('./../../assert');
const common = require('./../../common');

let battle;

describe('Flower Gift', () => {
	afterEach(() => {
		battle.destroy();
	});

	it(`should boost allies' Attack and Special Defense stats`, () => {
		battle = common.createBattle({ gameType: 'doubles' }, [[
			{ species: "Cherrim", ability: 'flowergift', moves: ['healbell'] },
			{ species: "Snorlax", ability: 'immunity', moves: ['healbell'] },
		], [
			{ species: "Blissey", ability: 'serenegrace', moves: ['healbell'] },
			{ species: "Blissey", ability: 'serenegrace', moves: ['healbell'] },
		]]);

		const cherAtk = battle.p1.active[0].getStat('atk');
		const cherSpd = battle.p1.active[0].getStat('spd');
		const baseAtk = battle.p1.active[1].getStat('atk');
		const baseSpd = battle.p1.active[1].getStat('spd');

		// Set the weather to sun and re-check
		battle.field.setWeather('sunnyday', 'debug');
		assert.equal(battle.p1.active[0].getStat('atk'), battle.modify(cherAtk, 1.5));
		assert.equal(battle.p1.active[0].getStat('spd'), battle.modify(cherSpd, 1.5));
		assert.equal(battle.p1.active[1].getStat('atk'), battle.modify(baseAtk, 1.5));
		assert.equal(battle.p1.active[1].getStat('spd'), battle.modify(baseSpd, 1.5));
	});

	it(`should still work if Cherrim transforms into something with Flower Gift without originally having it`, () => {
		battle = common.createBattle({ gameType: 'doubles' }, [[
			{ species: "Cherrim", ability: 'serenegrace', moves: ['transform'] },
			{ species: "Snorlax", ability: 'immunity', moves: ['healbell'] },
		], [
			{ species: "Blissey", ability: 'flowergift', moves: ['healbell'] },
			{ species: "Blissey", ability: 'flowergift', moves: ['healbell'] },
		]]);

		battle.makeChoices('move transform 1, move healbell', 'move healbell, move healbell');
		const cherAtk = battle.p1.active[0].getStat('atk');
		const cherSpd = battle.p1.active[0].getStat('spd');
		const baseAtk = battle.p1.active[1].getStat('atk');
		const baseSpd = battle.p1.active[1].getStat('spd');

		// Set the weather to sun and re-check
		battle.field.setWeather('sunnyday', 'debug');
		assert.equal(battle.p1.active[0].getStat('atk'), battle.modify(cherAtk, 1.5));
		assert.equal(battle.p1.active[0].getStat('spd'), battle.modify(cherSpd, 1.5));
		assert.equal(battle.p1.active[1].getStat('atk'), battle.modify(baseAtk, 1.5));
		assert.equal(battle.p1.active[1].getStat('spd'), battle.modify(baseSpd, 1.5));
	});

	it(`should not trigger if the Pokemon was KOed`, () => {
		// TODO: Is this interaction possible in Gen 9?
		battle = common.gen(8).createBattle([[
			{ species: 'Cherrim', ability: 'flowergift', moves: ['sleeptalk'] },
		], [
			{ species: 'Heatran', moves: ['blastburn'] },
		]]);
		battle.makeChoices('auto', 'move blastburn dynamax');
		assert(battle.log.every(line => !line.startsWith('|-formechange')));
	});
});