Merging Source v1.7.2: item changes
This commit is contained in:
@@ -46,7 +46,12 @@ public class Weapon extends KindOfWeapon {
|
||||
public int STR = 10;
|
||||
public float ACU = 1; // Accuracy modifier
|
||||
public float DLY = 1f; // Speed modifier
|
||||
|
||||
|
||||
public enum Imbue {
|
||||
NONE, SPEED, ACCURACY
|
||||
}
|
||||
public Imbue imbue = Imbue.NONE;
|
||||
|
||||
private int hitsToKnow = 20;
|
||||
|
||||
protected Enchantment enchantment;
|
||||
@@ -68,17 +73,20 @@ public class Weapon extends KindOfWeapon {
|
||||
}
|
||||
|
||||
private static final String ENCHANTMENT = "enchantment";
|
||||
private static final String IMBUE = "imbue";
|
||||
|
||||
@Override
|
||||
public void storeInBundle( Bundle bundle ) {
|
||||
super.storeInBundle( bundle );
|
||||
bundle.put( ENCHANTMENT, enchantment );
|
||||
bundle.put( IMBUE, imbue );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void restoreFromBundle( Bundle bundle ) {
|
||||
super.restoreFromBundle( bundle );
|
||||
enchantment = (Enchantment)bundle.get( ENCHANTMENT );
|
||||
imbue = bundle.getEnum( IMBUE, Imbue.class );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -104,8 +112,10 @@ public class Weapon extends KindOfWeapon {
|
||||
}
|
||||
ACU *= (float)(Math.pow(1.1, bonus));
|
||||
}
|
||||
|
||||
return encumbrance > 0 ? (float)((ACU) / Math.pow( 1.5, encumbrance )) : ACU;
|
||||
|
||||
return
|
||||
(encumbrance > 0 ? (float)(ACU / Math.pow( 1.5, encumbrance )) : ACU) *
|
||||
(imbue == Imbue.ACCURACY ? 1.5f : 1.0f);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -122,8 +132,10 @@ public class Weapon extends KindOfWeapon {
|
||||
}
|
||||
|
||||
float DLY = (float)(0.25 + (this.DLY - 0.25)*Math.pow(0.8, bonus));
|
||||
|
||||
return encumrance > 0 ? (float)(DLY * Math.pow( 1.2, encumrance )) : DLY;
|
||||
|
||||
return
|
||||
(encumrance > 0 ? (float)(DLY * Math.pow( 1.2, encumrance )) : DLY) *
|
||||
(imbue == Imbue.SPEED ? 0.6f : 1.0f);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -131,7 +143,7 @@ public class Weapon extends KindOfWeapon {
|
||||
|
||||
int damage = super.damageRoll( hero );
|
||||
|
||||
if (hero.usingRanged == (hero.heroClass == HeroClass.HUNTRESS)) {
|
||||
if ((hero.rangedWeapon != null) == (hero.heroClass == HeroClass.HUNTRESS)) {
|
||||
int exStr = hero.STR() - STR;
|
||||
if (exStr > 0) {
|
||||
damage += Random.IntRange( 0, exStr );
|
||||
|
||||
@@ -17,9 +17,11 @@
|
||||
*/
|
||||
package com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments;
|
||||
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Terror;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Vertigo;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.Weapon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite.Glowing;
|
||||
@@ -39,9 +41,12 @@ public class Horror extends Weapon.Enchantment {
|
||||
int level = Math.max( 0, weapon.level );
|
||||
|
||||
if (Random.Int( level + 5 ) >= 4) {
|
||||
|
||||
Terror terror = Buff.affect( defender, Terror.class, Terror.DURATION );
|
||||
terror.source = attacker;
|
||||
|
||||
if (defender == Dungeon.hero) {
|
||||
Buff.affect( defender, Vertigo.class, Vertigo.duration(defender) );
|
||||
} else {
|
||||
Buff.affect( defender, Terror.class, Terror.DURATION ).source = attacker;
|
||||
}
|
||||
|
||||
return true;
|
||||
} else {
|
||||
|
||||
@@ -114,7 +114,16 @@ public class MeleeWeapon extends Weapon {
|
||||
info.append( " weapon. ");
|
||||
} else if (ACU != 1f) {
|
||||
info.append( "This is a rather " + (ACU > 1f ? "accurate" : "inaccurate") + " weapon. " );
|
||||
}
|
||||
}
|
||||
switch (imbue) {
|
||||
case SPEED:
|
||||
info.append( "It was balanced to make it faster. " );
|
||||
break;
|
||||
case ACCURACY:
|
||||
info.append( "It was balanced to make it more accurate. " );
|
||||
break;
|
||||
case NONE:
|
||||
}
|
||||
|
||||
if (enchantment != null) {
|
||||
info.append( "It is enchanted." );
|
||||
|
||||
@@ -76,27 +76,41 @@ public class Boomerang extends MissileWeapon {
|
||||
|
||||
return super.enchant( ench );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void proc( Char attacker, Char defender, int damage ) {
|
||||
super.proc( attacker, defender, damage );
|
||||
if (attacker instanceof Hero && ((Hero)attacker).usingRanged) {
|
||||
circleBack( defender.pos, (Hero)attacker );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void miss( int cell ) {
|
||||
circleBack( cell, curUser );
|
||||
}
|
||||
|
||||
private void circleBack( int from, Hero owner ) {
|
||||
if (!collect( curUser.belongings.backpack )) {
|
||||
Dungeon.level.drop( this, owner.pos ).sprite.drop();
|
||||
}
|
||||
((MissileSprite)curUser.sprite.parent.recycle( MissileSprite.class )).
|
||||
reset( from, curUser.pos, curItem, null );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void proc( Char attacker, Char defender, int damage ) {
|
||||
super.proc( attacker, defender, damage );
|
||||
if (attacker instanceof Hero && ((Hero)attacker).rangedWeapon == this) {
|
||||
circleBack( defender.pos, (Hero)attacker );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void miss( int cell ) {
|
||||
circleBack( cell, curUser );
|
||||
}
|
||||
|
||||
private void circleBack( int from, Hero owner ) {
|
||||
|
||||
((MissileSprite)curUser.sprite.parent.recycle( MissileSprite.class )).
|
||||
reset( from, curUser.pos, curItem, null );
|
||||
|
||||
if (throwEquiped) {
|
||||
owner.belongings.weapon = this;
|
||||
owner.spend( -TIME_TO_EQUIP );
|
||||
} else
|
||||
if (!collect( curUser.belongings.backpack )) {
|
||||
Dungeon.level.drop( this, owner.pos ).sprite.drop();
|
||||
}
|
||||
}
|
||||
|
||||
private boolean throwEquiped;
|
||||
|
||||
@Override
|
||||
public void cast( Hero user, int dst ) {
|
||||
throwEquiped = isEquipped( user );
|
||||
super.cast( user, dst );
|
||||
}
|
||||
|
||||
@Override
|
||||
public String desc() {
|
||||
|
||||
+3
-3
@@ -94,9 +94,9 @@ public class MissileWeapon extends Weapon {
|
||||
super.proc( attacker, defender, damage );
|
||||
|
||||
Hero hero = (Hero)attacker;
|
||||
if (!hero.usingRanged && stackable) {
|
||||
if (quantity == 1) {
|
||||
doUnequip( hero, false );
|
||||
if (hero.rangedWeapon == null && stackable) {
|
||||
if (quantity == 1) {
|
||||
doUnequip( hero, false, false );
|
||||
} else {
|
||||
detach( null );
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user