From 53dc34a1b3b137be8a9d54d0f7abaa914cea13f7 Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Tue, 5 Jun 2018 17:21:06 -0400 Subject: [PATCH] v0.7.0: added a tipped dart for swiftthistle --- .../shatteredpixeldungeon/actors/Char.java | 2 + .../actors/buffs/Adrenaline.java | 53 +++++++++++++++++++ .../actors/mobs/Golem.java | 2 +- .../actors/mobs/Mob.java | 5 +- .../actors/mobs/Monk.java | 2 +- .../actors/mobs/Statue.java | 2 +- .../actors/mobs/Thief.java | 2 +- .../items/artifacts/DriedRose.java | 6 +-- .../weapon/missiles/darts/AdrenalineDart.java | 47 ++++++++++++++++ .../weapon/missiles/darts/TippedDart.java | 2 + .../messages/actors/actors.properties | 3 ++ .../messages/items/items.properties | 3 ++ 12 files changed, 121 insertions(+), 8 deletions(-) create mode 100644 core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Adrenaline.java create mode 100644 core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/darts/AdrenalineDart.java diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/Char.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/Char.java index 20350f8a2..ade385794 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/Char.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/Char.java @@ -26,6 +26,7 @@ import com.shatteredpixel.shatteredpixeldungeon.Dungeon; import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Blob; import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Electricity; import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.ToxicGas; +import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Adrenaline; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Bleeding; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Bless; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff; @@ -280,6 +281,7 @@ public abstract class Char extends Actor { public float speed() { float speed = baseSpeed; if ( buff( Cripple.class ) != null ) speed /= 2f; + if ( buff( Adrenaline.class ) != null) speed *= 2f; if ( buff( Haste.class ) != null) speed *= 3f; return speed; } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Adrenaline.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Adrenaline.java new file mode 100644 index 000000000..2ea1ee788 --- /dev/null +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Adrenaline.java @@ -0,0 +1,53 @@ +/* + * Pixel Dungeon + * Copyright (C) 2012-2015 Oleg Dolya + * + * Shattered Pixel Dungeon + * Copyright (C) 2014-2018 Evan Debenham + * + * 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 + */ + +package com.shatteredpixel.shatteredpixeldungeon.actors.buffs; + +import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; +import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator; +import com.watabou.noosa.Image; + +public class Adrenaline extends FlavourBuff { + + public static final float DURATION = 10f; + + @Override + public int icon() { + //TODO + return BuffIndicator.IMMUNITY; + } + + @Override + public void tintIcon(Image icon) { + greyIcon(icon, 5f, cooldown()); + } + + @Override + public String toString() { + return Messages.get(this, "name"); + } + + @Override + public String desc() { + return Messages.get(this, "desc", dispTurns()); + } + +} diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Golem.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Golem.java index 558bb9f6e..beb54debe 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Golem.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Golem.java @@ -55,7 +55,7 @@ public class Golem extends Mob { @Override protected float attackDelay() { - return 1.5f; + return super.attackDelay() * 1.5f; } @Override diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Mob.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Mob.java index 4d740e207..a3bae7a19 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Mob.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Mob.java @@ -28,6 +28,7 @@ import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon; import com.shatteredpixel.shatteredpixeldungeon.Statistics; import com.shatteredpixel.shatteredpixeldungeon.actors.Actor; import com.shatteredpixel.shatteredpixeldungeon.actors.Char; +import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Adrenaline; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Amok; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Corruption; @@ -452,7 +453,9 @@ public abstract class Mob extends Char { } protected float attackDelay() { - return 1f; + float delay = 1f; + if ( buff(Adrenaline.class) != null) delay /= 1.5f; + return delay; } protected boolean doAttack( Char enemy ) { diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Monk.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Monk.java index 9b82c283f..d524998da 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Monk.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Monk.java @@ -66,7 +66,7 @@ public class Monk extends Mob { @Override protected float attackDelay() { - return 0.5f; + return super.attackDelay()*0.5f; } @Override diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Statue.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Statue.java index 310d68c1c..826f1ab89 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Statue.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Statue.java @@ -94,7 +94,7 @@ public class Statue extends Mob { @Override protected float attackDelay() { - return weapon.speedFactor( this ); + return super.attackDelay()*weapon.speedFactor( this ); } @Override diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Thief.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Thief.java index e27a0c8ae..0afc90948 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Thief.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Thief.java @@ -89,7 +89,7 @@ public class Thief extends Mob { @Override protected float attackDelay() { - return 0.5f; + return super.attackDelay()*0.5f; } @Override diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/DriedRose.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/DriedRose.java index ba04bd01a..92c7b194b 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/DriedRose.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/DriedRose.java @@ -487,11 +487,11 @@ public class DriedRose extends Artifact { @Override protected float attackDelay() { + float delay = super.attackDelay(); if (rose != null && rose.weapon != null){ - return rose.weapon.speedFactor(this); - } else { - return super.attackDelay(); + delay *= rose.weapon.speedFactor(this); } + return delay; } @Override diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/darts/AdrenalineDart.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/darts/AdrenalineDart.java new file mode 100644 index 000000000..68f0cfd19 --- /dev/null +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/darts/AdrenalineDart.java @@ -0,0 +1,47 @@ +/* + * Pixel Dungeon + * Copyright (C) 2012-2015 Oleg Dolya + * + * Shattered Pixel Dungeon + * Copyright (C) 2014-2018 Evan Debenham + * + * 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 + */ + +package com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.darts; + +import com.shatteredpixel.shatteredpixeldungeon.actors.Char; +import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Adrenaline; +import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff; +import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet; + +public class AdrenalineDart extends TippedDart { + + { + //TODO + image = ItemSpriteSheet.BLINDING_DART; + } + + @Override + public int proc(Char attacker, Char defender, int damage) { + + Buff.prolong( defender, Adrenaline.class, Adrenaline.DURATION); + + if (attacker.alignment == defender.alignment){ + return 0; + } + + return super.proc(attacker, defender, damage); + } +} diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/darts/TippedDart.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/darts/TippedDart.java index 44e57f447..dd644ffbf 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/darts/TippedDart.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/darts/TippedDart.java @@ -41,6 +41,7 @@ import com.shatteredpixel.shatteredpixeldungeon.plants.Sorrowmoss; import com.shatteredpixel.shatteredpixeldungeon.plants.Starflower; import com.shatteredpixel.shatteredpixeldungeon.plants.Stormvine; import com.shatteredpixel.shatteredpixeldungeon.plants.Sungrass; +import com.shatteredpixel.shatteredpixeldungeon.plants.Swiftthistle; import java.util.ArrayList; import java.util.HashMap; @@ -82,6 +83,7 @@ public abstract class TippedDart extends Dart { types.put(Starflower.Seed.class, HolyDart.class); types.put(Stormvine.Seed.class, ShockingDart.class); types.put(Sungrass.Seed.class, HealingDart.class); + types.put(Swiftthistle.Seed.class, AdrenalineDart.class); } public static TippedDart randomTipped(){ diff --git a/core/src/main/resources/com/shatteredpixel/shatteredpixeldungeon/messages/actors/actors.properties b/core/src/main/resources/com/shatteredpixel/shatteredpixeldungeon/messages/actors/actors.properties index 86224bc8b..c09dec156 100644 --- a/core/src/main/resources/com/shatteredpixel/shatteredpixeldungeon/messages/actors/actors.properties +++ b/core/src/main/resources/com/shatteredpixel/shatteredpixeldungeon/messages/actors/actors.properties @@ -35,6 +35,9 @@ actors.blobs.web.desc=Everything is covered with a thick web here. ###buffs +actors.buffs.adrenaline.name=Adrenaline +actors.buffs.adrenaline.desc=A surge of physical power, adrenaline enhanced both attack and movement speed.\n\nAdrenaline allows its target to run at 2x speed, and attack at 1.5x speed.\n\nTurns remaining: %s. + actors.buffs.amok.name=Amok actors.buffs.amok.desc=Amok causes a state of great rage and confusion in its target.\n\nWhen a creature is amoked, they will attack whatever is near them, whether they be friend or foe.\n\nTurns of amok remaining: %s. diff --git a/core/src/main/resources/com/shatteredpixel/shatteredpixeldungeon/messages/items/items.properties b/core/src/main/resources/com/shatteredpixel/shatteredpixeldungeon/messages/items/items.properties index 9858acfd0..25a009a23 100644 --- a/core/src/main/resources/com/shatteredpixel/shatteredpixeldungeon/messages/items/items.properties +++ b/core/src/main/resources/com/shatteredpixel/shatteredpixeldungeon/messages/items/items.properties @@ -1009,6 +1009,9 @@ items.weapon.melee.wornshortsword.desc=A quite short sword, worn down through he ###missile weapons +items.weapon.missiles.darts.adrenalinedart.name=adrenaline dart +items.weapon.missiles.darts.adrenalinedart.desc=These darts are tipped with a swiftthistle-based compound which will give their target a boost in speed. This boost affects both speed of movement and of attacking, though movement is improved more. + items.weapon.missiles.darts.blindingdart.name=blinding dart items.weapon.missiles.darts.blindingdart.desc=These darts are tipped with a blindweed-based compound which will blind their target for a short time. They do not disorient however, so an enemy will still know where they last saw you.