V0.2.0: Implemented Ring of Sharpshooting
This commit is contained in:
parent
902b2a096f
commit
2ad10e7168
|
@ -24,6 +24,7 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Drowsy;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.effects.CellEmitter;
|
import com.shatteredpixel.shatteredpixeldungeon.effects.CellEmitter;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.CapeOfThorns;
|
import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.CapeOfThorns;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.rings.RingOfForce;
|
import com.shatteredpixel.shatteredpixeldungeon.items.rings.RingOfForce;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.items.rings.RingOfSharpshooting;
|
||||||
import com.watabou.noosa.Camera;
|
import com.watabou.noosa.Camera;
|
||||||
import com.watabou.noosa.Game;
|
import com.watabou.noosa.Game;
|
||||||
import com.watabou.noosa.audio.Sample;
|
import com.watabou.noosa.audio.Sample;
|
||||||
|
@ -255,10 +256,16 @@ public class Hero extends Char {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int attackSkill( Char target ) {
|
public int attackSkill( Char target ) {
|
||||||
if (belongings.weapon != null) {
|
if (belongings.weapon != null && !usingRanged) {
|
||||||
return (int)(attackSkill * belongings.weapon.acuracyFactor( this ));
|
return (int) (attackSkill * belongings.weapon.acuracyFactor(this));
|
||||||
} else {
|
} else if (usingRanged){
|
||||||
return (int)(attackSkill);
|
int bonus = 0;
|
||||||
|
for (Buff buff : buffs(RingOfSharpshooting.Aim.class)) {
|
||||||
|
bonus += ((RingOfSharpshooting.Aim)buff).level;
|
||||||
|
}
|
||||||
|
return (int)(attackSkill * Math.pow(1.1, bonus));
|
||||||
|
} else {
|
||||||
|
return attackSkill;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ package com.shatteredpixel.shatteredpixeldungeon.items.rings;
|
||||||
* Created by debenhame on 10/09/2014.
|
* Created by debenhame on 10/09/2014.
|
||||||
*/
|
*/
|
||||||
public class RingOfSharpshooting extends Ring {
|
public class RingOfSharpshooting extends Ring {
|
||||||
//TODO: tie this into game logic
|
//TODO: testing, numbers tweaking
|
||||||
{
|
{
|
||||||
name = "Ring of Sharpshooting";
|
name = "Ring of Sharpshooting";
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,6 +25,7 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Fire;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
|
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Burning;
|
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Burning;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
|
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.items.rings.RingOfSharpshooting;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
|
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
|
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
|
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
|
||||||
|
@ -63,6 +64,14 @@ public class IncendiaryDart extends MissileWeapon {
|
||||||
} else {
|
} else {
|
||||||
if (!curUser.shoot( enemy, this )) {
|
if (!curUser.shoot( enemy, this )) {
|
||||||
Dungeon.level.drop( this, cell ).sprite.drop();
|
Dungeon.level.drop( this, cell ).sprite.drop();
|
||||||
|
//TODO: test this
|
||||||
|
} else {
|
||||||
|
int bonus = 0;
|
||||||
|
for (Buff buff : curUser.buffs(RingOfSharpshooting.Aim.class)) {
|
||||||
|
bonus += ((RingOfSharpshooting.Aim)buff).level;
|
||||||
|
}
|
||||||
|
if (Random.Float() > Math.pow(0.7, bonus))
|
||||||
|
Dungeon.level.drop( this, cell ).sprite.drop();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,12 +22,15 @@ import java.util.ArrayList;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
|
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
|
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.HeroClass;
|
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.HeroClass;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
|
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.items.rings.RingOfSharpshooting;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.Weapon;
|
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.Weapon;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
|
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.windows.WndOptions;
|
import com.shatteredpixel.shatteredpixeldungeon.windows.WndOptions;
|
||||||
|
import com.watabou.utils.Random;
|
||||||
|
|
||||||
public class MissileWeapon extends Weapon {
|
public class MissileWeapon extends Weapon {
|
||||||
|
|
||||||
|
@ -61,7 +64,15 @@ public class MissileWeapon extends Weapon {
|
||||||
} else {
|
} else {
|
||||||
if (!curUser.shoot( enemy, this )) {
|
if (!curUser.shoot( enemy, this )) {
|
||||||
miss( cell );
|
miss( cell );
|
||||||
}
|
//TODO: test this
|
||||||
|
} else {
|
||||||
|
int bonus = 0;
|
||||||
|
for (Buff buff : curUser.buffs(RingOfSharpshooting.Aim.class)) {
|
||||||
|
bonus += ((RingOfSharpshooting.Aim)buff).level;
|
||||||
|
}
|
||||||
|
if (Random.Float() > Math.pow(0.7, bonus))
|
||||||
|
Dungeon.level.drop( this, cell ).sprite.drop();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user