v0.4.0: added the ability for weapons to give DR, gave it to quarterstaff

This commit is contained in:
Evan Debenham 2016-05-15 04:43:41 -04:00
parent 84324c6f52
commit 7021b01821
4 changed files with 17 additions and 7 deletions

View File

@ -296,11 +296,13 @@ public class Hero extends Char {
@Override
public int dr() {
int dr = belongings.armor != null ? Math.max( belongings.armor.DR(), 0 ) : 0;
Barkskin barkskin = buff( Barkskin.class );
if (barkskin != null) {
dr += barkskin.level();
}
int dr = 0;
Barkskin bark = buff(Barkskin.class);
if (belongings.armor != null) dr += Math.max( belongings.armor.DR(), 0);
if (belongings.weapon != null) dr += Math.max( belongings.weapon.defenceFactor( this ), 0 );
if (bark != null) dr += bark.level();
return dr;
}

View File

@ -103,6 +103,10 @@ abstract public class KindOfWeapon extends EquipableItem {
public int reachFactor( Hero hero ){
return 1;
}
public int defenceFactor( Hero hero ) {
return 0;
}
public void proc( Char attacker, Char defender, int damage ) {
}

View File

@ -20,6 +20,7 @@
*/
package com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
public class Quarterstaff extends MeleeWeapon {
@ -36,6 +37,8 @@ public class Quarterstaff extends MeleeWeapon {
lvl*(tier+1); //scaling unchanged
}
//TODO add defence bonus code
@Override
public int defenceFactor(Hero hero) {
return 2+level(); //2 extra defence, plus 1 per level;
}
}

View File

@ -736,6 +736,7 @@ items.weapon.melee.newshortsword.name=shortsword
items.weapon.melee.newshortsword.desc=A quite short sword, only a few inches longer than a dagger.
items.weapon.melee.quarterstaff.name=quarterstaff
items.weapon.melee.quarterstaff.stats_desc=This weapon increases your damage absorbtion.
items.weapon.melee.quarterstaff.desc=A staff of hardwood, its ends are shod with iron.
items.weapon.melee.spear.name=spear