/
PoisonGas.java
89 lines (76 loc) · 2.68 KB
/
PoisonGas.java
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
/*
* Pixel Dungeon
* Copyright (C) 2012-2014 Oleg Dolya
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.hmdzl.spspd.actors.blobs;
import com.hmdzl.spspd.actors.Actor;
import com.hmdzl.spspd.actors.Char;
import com.hmdzl.spspd.actors.buffs.ArmorBreak;
import com.hmdzl.spspd.actors.buffs.Buff;
import com.hmdzl.spspd.actors.buffs.Burning;
import com.hmdzl.spspd.actors.buffs.Roots;
import com.hmdzl.spspd.actors.buffs.Slow;
import com.hmdzl.spspd.effects.BlobEmitter;
import com.hmdzl.spspd.effects.Speck;
import com.hmdzl.spspd.Dungeon;
import com.hmdzl.spspd.actors.buffs.Tar;
import com.hmdzl.spspd.messages.Messages;
import com.watabou.utils.Random;
import com.hmdzl.spspd.levels.Level;
import com.hmdzl.spspd.scenes.GameScene;
public class PoisonGas extends Blob {
@Override
protected void evolve() {
super.evolve();
Char ch;
for (int i = 0; i < LENGTH; i++) {
if (cur[i] > 0 && (ch = Actor.findChar(i)) != null) {
if (!ch.immunities().contains(this.getClass())){
Buff.affect(ch,Slow.class,3f);
Buff.affect(ch,Roots.class,3f);
Buff.affect(ch,ArmorBreak.class,3f).level(20);
}
}
}
Blob blob = Dungeon.level.blobs.get( Fire.class );
if (blob != null) {
for (int pos=0; pos < LENGTH; pos++) {
if ( cur[pos] > 0 && blob.cur[ pos ] < 2 ) {
int flammability = 0;
for (int n : Level.NEIGHBOURS8) {
if ( blob.cur[ pos + n ] > 0 ) {
flammability++;
}
}
if( Random.Int( 4 ) < flammability ) {
blob.volume += ( blob.cur[ pos ] = 2 );
volume -= ( cur[pos] / 2 );
cur[pos] -=( cur[pos] / 2 );
}
}
}
}
}
@Override
public void use(BlobEmitter emitter) {
super.use(emitter);
emitter.pour(Speck.factory(Speck.TARGAS,true ), 0.6f);
}
@Override
public String tileDesc() {
return Messages.get(this, "desc");
}
}