From 4e34e81365203fe726803b74a31ef1d963864181 Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Sun, 5 Apr 2015 12:40:01 -0400 Subject: [PATCH] v0.3.0: improved previous hunger mechanics changes, now better coded & clarified --- assets/buffs.png | Bin 3653 -> 3662 bytes assets/large_buffs.png | Bin 4605 -> 4635 bytes .../actors/buffs/Hunger.java | 4 +-- .../actors/buffs/LockedFloor.java | 33 ++++++++++++++++++ .../actors/hero/Hero.java | 2 +- .../actors/mobs/Goo.java | 4 +-- .../levels/CavesBossLevel.java | 4 +-- .../levels/CityBossLevel.java | 4 +-- .../levels/HallsBossLevel.java | 4 +-- .../shatteredpixeldungeon/levels/Level.java | 14 ++++++++ .../levels/PrisonBossLevel.java | 4 +-- .../levels/SewerBossLevel.java | 4 +-- .../ui/BuffIndicator.java | 1 + 13 files changed, 63 insertions(+), 15 deletions(-) create mode 100644 src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/LockedFloor.java diff --git a/assets/buffs.png b/assets/buffs.png index 575cfe8c436138fba1337e7e766e866cc029940b..32b19ca662308c402a0d4881a9623780d363c935 100644 GIT binary patch delta 746 zcmVn}(*(CW#e>p~$Z3lPP7oFomW))13)lYIY}+NtXaOVF-XlUjg>__W^K< zUp}4rf6u+!-m~9+#Otv=yv9GT6<~7{06|b?|1%T-Mxzk{DwT=?q+@^#0SW}z+1}pX zSpn!yn%(B4TQ1{6bzlJt939G;3FeoX-$Un~-_}=qD8p|!Ha;Dw1_aPr2S}&W29N zeuh_2D8K^DzlU=tS}P9V2W}#OpLF2h4F`tm0J`d*z%n2N7*UA>5dg+#2L9qeoPi%S zAaMZg<>2iMXj?c?6=p!rPyjeb5r7t?w$Ohob&-if_{R*aZ^3xX3^)gCl9)4sdd&k|}HYYKr*TUEH|g5}+DTRW!dOz!6pN zyi7aO7XWyk2Y`m>H2`p=^`xs#fO`eV5Apyw!Ty{i0LK&oY6K`!zAJ1W&Q$Y6vX@41tFbvOfT5Kyn4YXMlImN-|KR;tZfYV~}JZ0eHt2L;(M}1+M5KtZza1 c!TNB3UxQaO!=N-EH~;_u07*qoM6N<$f(*$1%x)5>wD#C9&L-v@73O&-v(hjfnR>n6 z2)ARJnS4{rG%$TNNvtpoMRrVIOexd3DKzbxZcX@5qca|lI|R56LjcTs3b41g2Y^$2 zfAi_gf9l?JpZwMX9uKX-6@Gc80PE`j2!b;G&oBTO4u=FNl}ZYbjsY?R$P-{|b8~ZR z37|7>bQ4g7eGF@4~t3xAf5($lwQVJ3bRA2L#Z03y@By4Il%6 zybk<%Eda)i1~2*(U^JhDz!4jf8E*fEfAU-UAb?ycfCv%@U>_u}paOsjUqOklAWfxs z{0v_~K92}+{$1R+qO+6$zTi3nm@mZw_r442b_J(hqi$Je*n-~ zY(e_pTM+4+sb*@M)=be-MqBl0Ixyj*ecV}7(X?&)Zi@KnE^fHkS`#`*oM)g8ey30FEgFR0&X^d{<~6PF2eQ+M>4r z6RN%Dy@W5`n&UaVQZ=2&9Ub`Je}O=9uIuI`+slF=+q|cmJpS=^3{WUsUS1Xo@MKe` z^}5J(x|+ZRwE}?u0D$vT6NmvUfjjD;-*++n2;jb0pAPT}Cbl}` TR%gB&00000NkvXXu0mjffWkr4 diff --git a/assets/large_buffs.png b/assets/large_buffs.png index 624f5f7c4931737311ba027b77fcce7479250c07..0e4e2476ef3b283b08f5d4640056d6675e9dd150 100644 GIT binary patch delta 1747 zcmXYydpMMd9)N$}H)C!_W`-EITxQykm>i2vF~hpfQm&h8jqP#Cq0vgsapL=sRc$RN zlC9jLv{Y_;aB}-9PddwLXjr*qPDiAy6s576IeVVx{P8}|``7#L`-yjj-*lL_dgK0e3c6T)MNgE-qaZ~nTCMpSK&^@2@DnHE9w5%-vB5l{JlKFWD~z#*4}UI ztKa`Lxu{lQd+~YRvQwZUsW!>WgV)?LqcO>tcTZTFD$gGsAG@#C-PF2m*RBmL{h*#* zR`5jl-SAhopROOPS*;s!x$Yt!MpJEX+uYv%{^HlyL)_s{>#9OfCYF#MN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^+%?lBAqZjzzU%G^0~&v(fyu9kmg{w~!FY;wF4~Icpd2_b%A8WNZwK-Hdp6 z7g5obld*5KrW!FS3Pi*O5Q4(xO}QjEijg|v6r!`Gb7|B@9mf(F1j|@Ayv!H&&=!N4r@B?6*+r;GwD4EN!vMxPM^mD@A<`D!o~KHt zePl-X>p^xXQKlT6;3dUL4+>{{xSH#BA4CfcN%1a8_ZSFs+j#~of2cgxSr8@m%s>y9 zVI*}7u|0C;jiCgh8B$|-CM(aLjZjeEAqv4ANqYLXs9#D>%h&r6ZSm%drRwWuNjq5h zEgMwvNFT@AXGnm4e}d-P{T92!`48$jAHy}0)sfJCDWg%Dc(U$?pXK$Ne?q6+kD|Tf zVwQH^xYl6%DOA}MU?kUBM1fwU?ln^DYq*-e1KaXWsyMfi@A6+HKvFGs>TkKzo}*-Y zFuo@oT#^eb{_>}Co|BgXrX$ueJC*&{g_3E`+iIMH`$Y&2o9#E`3VtdJaAaD_l;5Ii z_m7V@!r`s7RTrGi;LSms|n4*DKF!|+vdLSu|}lP zI8e`9JW^C2&B{jPJx!p0G_KGS$wx2eE(YD-`P;4aM)(gFrufJz!nHIbD(zy(xQ>5S z0x9aMhy3a4FD!b7)-bb= HT) { + if (isStarving() || HP >= HT || Dungeon.level.locked) { restoreHealth = false; } else { spend( TIME_TO_REST ); next(); diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Goo.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Goo.java index 9b501fdda..584dfceff 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Goo.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Goo.java @@ -186,7 +186,7 @@ public class Goo extends Mob { @Override public void move( int step ) { - ((SewerBossLevel)Dungeon.level).seal(); + Dungeon.level.seal(); super.move( step ); } @@ -195,7 +195,7 @@ public class Goo extends Mob { super.die( cause ); - ((SewerBossLevel)Dungeon.level).unseal(); + Dungeon.level.unseal(); GameScene.bossSlain(); Dungeon.level.drop( new SkeletonKey( Dungeon.depth ), pos ).sprite.drop(); diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/levels/CavesBossLevel.java b/src/com/shatteredpixel/shatteredpixeldungeon/levels/CavesBossLevel.java index 6d341b2c5..6c5b46080 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/levels/CavesBossLevel.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/levels/CavesBossLevel.java @@ -218,7 +218,7 @@ public class CavesBossLevel extends Level { if (!enteredArena && outsideEntraceRoom( cell ) && hero == Dungeon.hero) { enteredArena = true; - locked = true; + seal(); Mob boss = Bestiary.mob( Dungeon.depth ); boss.state = boss.HUNTING; @@ -246,7 +246,7 @@ public class CavesBossLevel extends Level { if (!keyDropped && item instanceof SkeletonKey) { keyDropped = true; - locked = false; + unseal(); CellEmitter.get( arenaDoor ).start( Speck.factory( Speck.ROCK ), 0.07f, 10 ); diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/levels/CityBossLevel.java b/src/com/shatteredpixel/shatteredpixeldungeon/levels/CityBossLevel.java index ca81d9fe2..bb700b294 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/levels/CityBossLevel.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/levels/CityBossLevel.java @@ -177,7 +177,7 @@ public class CityBossLevel extends Level { if (!enteredArena && outsideEntraceRoom( cell ) && hero == Dungeon.hero) { enteredArena = true; - locked = true; + seal(); Mob boss = Bestiary.mob( Dungeon.depth ); boss.state = boss.HUNTING; @@ -208,7 +208,7 @@ public class CityBossLevel extends Level { if (!keyDropped && item instanceof SkeletonKey) { keyDropped = true; - locked = false; + unseal(); set( arenaDoor, Terrain.DOOR ); GameScene.updateMap( arenaDoor ); diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/levels/HallsBossLevel.java b/src/com/shatteredpixel/shatteredpixeldungeon/levels/HallsBossLevel.java index 2a6a21619..d3f9b36c6 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/levels/HallsBossLevel.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/levels/HallsBossLevel.java @@ -167,7 +167,7 @@ public class HallsBossLevel extends Level { if (!enteredArena && hero == Dungeon.hero && cell != entrance) { enteredArena = true; - locked = true; + seal(); for (int i=ROOM_LEFT-1; i <= ROOM_RIGHT + 1; i++) { doMagic( (ROOM_TOP - 1) * WIDTH + i ); @@ -206,7 +206,7 @@ public class HallsBossLevel extends Level { if (!keyDropped && item instanceof SkeletonKey) { keyDropped = true; - locked = false; + unseal(); entrance = stairs; set( entrance, Terrain.ENTRANCE ); diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/levels/Level.java b/src/com/shatteredpixel/shatteredpixeldungeon/levels/Level.java index 34f302c2e..a9b9e3c58 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/levels/Level.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/levels/Level.java @@ -29,6 +29,7 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.WellWater; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Awareness; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Blindness; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff; +import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.LockedFloor; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.MindVision; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Shadows; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero; @@ -415,6 +416,19 @@ public abstract class Level implements Bundlable { abstract protected void createItems(); + public void seal(){ + if (!locked) { + locked = true; + Buff.affect(Dungeon.hero, LockedFloor.class); + } + } + + public void unseal(){ + if (locked) { + locked = false; + } + } + public void addVisuals( Scene scene ) { for (int i=0; i < LENGTH; i++) { if (pit[i]) { diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/levels/PrisonBossLevel.java b/src/com/shatteredpixel/shatteredpixeldungeon/levels/PrisonBossLevel.java index a1b845d1d..ab8ed3fa7 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/levels/PrisonBossLevel.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/levels/PrisonBossLevel.java @@ -309,7 +309,7 @@ public class PrisonBossLevel extends RegularLevel { if (ch == Dungeon.hero && !enteredArena && roomExit.inside( cell )) { enteredArena = true; - locked = true; + seal(); int pos; do { @@ -337,7 +337,7 @@ public class PrisonBossLevel extends RegularLevel { if (!keyDropped && item instanceof SkeletonKey) { keyDropped = true; - locked = false; + unseal(); set( arenaDoor, Terrain.DOOR ); GameScene.updateMap( arenaDoor ); diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/levels/SewerBossLevel.java b/src/com/shatteredpixel/shatteredpixeldungeon/levels/SewerBossLevel.java index 78534b222..8533ffe7b 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/levels/SewerBossLevel.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/levels/SewerBossLevel.java @@ -241,7 +241,7 @@ public class SewerBossLevel extends RegularLevel { public void seal() { if (entrance != 0) { - locked = true; + super.seal(); set( entrance, Terrain.WATER_TILES ); GameScene.updateMap( entrance ); @@ -255,7 +255,7 @@ public class SewerBossLevel extends RegularLevel { public void unseal() { if (stairs != 0) { - locked = false; + super.unseal(); entrance = stairs; stairs = 0; diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/ui/BuffIndicator.java b/src/com/shatteredpixel/shatteredpixeldungeon/ui/BuffIndicator.java index 9ecce0be9..138a9452c 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/ui/BuffIndicator.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/ui/BuffIndicator.java @@ -68,6 +68,7 @@ public class BuffIndicator extends Component { public static final int FORESIGHT = 32; public static final int VERTIGO = 33; public static final int CHARGE = 34; + public static final int LOCKED_FLOOR= 35; public static final int SIZE = 7;