Merging Source v1.7.2: actor changes
This commit is contained in:
@@ -49,108 +49,112 @@ public class Thief extends Mob {
|
||||
maxLvl = 10;
|
||||
|
||||
loot = MasterThievesArmband.class;
|
||||
lootChance = 0.01f;
|
||||
}
|
||||
|
||||
private static final String ITEM = "item";
|
||||
|
||||
@Override
|
||||
public void storeInBundle( Bundle bundle ) {
|
||||
super.storeInBundle( bundle );
|
||||
bundle.put( ITEM, item );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void restoreFromBundle( Bundle bundle ) {
|
||||
super.restoreFromBundle( bundle );
|
||||
item = (Item)bundle.get( ITEM );
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageRoll() {
|
||||
return Random.NormalIntRange( 1, 7 );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected float attackDelay() {
|
||||
return 0.5f;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void nowhereToRun() {
|
||||
if (buff( Terror.class ) == null) {
|
||||
sprite.showStatus( CharSprite.NEGATIVE, TXT_RAGE );
|
||||
state = State.HUNTING;
|
||||
} else {
|
||||
super.nowhereToRun();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void die( Object cause ) {
|
||||
lootChance = 0.01f;
|
||||
|
||||
super.die( cause );
|
||||
|
||||
if (item != null) {
|
||||
Dungeon.level.drop( item, pos ).sprite.drop();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int attackSkill( Char target ) {
|
||||
return 12;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int dr() {
|
||||
return 3;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int attackProc( Char enemy, int damage ) {
|
||||
if (item == null && enemy instanceof Hero && steal( (Hero)enemy )) {
|
||||
state = State.FLEEING;
|
||||
}
|
||||
|
||||
return damage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int defenseProc(Char enemy, int damage) {
|
||||
if (state == State.FLEEING) {
|
||||
Dungeon.level.drop( new Gold(), pos ).sprite.drop();
|
||||
}
|
||||
|
||||
return damage;
|
||||
}
|
||||
|
||||
protected boolean steal( Hero hero ) {
|
||||
|
||||
Item item = hero.belongings.randomUnequipped();
|
||||
if (item != null) {
|
||||
|
||||
GLog.w( TXT_STOLE, this.name, item.name() );
|
||||
|
||||
item.detachAll( hero.belongings.backpack );
|
||||
this.item = item;
|
||||
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String description() {
|
||||
String desc =
|
||||
"Deeper levels of the dungeon have always been a hiding place for all kinds of criminals. " +
|
||||
"Not all of them could keep a clear mind during their extended periods so far from daylight. Long ago, " +
|
||||
"these crazy thieves and bandits have forgotten who they are and why they steal.";
|
||||
|
||||
if (item != null) {
|
||||
desc += String.format( TXT_CARRIES, Utils.capitalize( this.name ), item.name() );
|
||||
}
|
||||
|
||||
return desc;
|
||||
}
|
||||
FLEEING = new Fleeing();
|
||||
}
|
||||
|
||||
private static final String ITEM = "item";
|
||||
|
||||
@Override
|
||||
public void storeInBundle( Bundle bundle ) {
|
||||
super.storeInBundle( bundle );
|
||||
bundle.put( ITEM, item );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void restoreFromBundle( Bundle bundle ) {
|
||||
super.restoreFromBundle( bundle );
|
||||
item = (Item)bundle.get( ITEM );
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageRoll() {
|
||||
return Random.NormalIntRange( 1, 7 );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected float attackDelay() {
|
||||
return 0.5f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void die( Object cause ) {
|
||||
|
||||
super.die( cause );
|
||||
|
||||
if (item != null) {
|
||||
Dungeon.level.drop( item, pos ).sprite.drop();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int attackSkill( Char target ) {
|
||||
return 12;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int dr() {
|
||||
return 3;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int attackProc( Char enemy, int damage ) {
|
||||
if (item == null && enemy instanceof Hero && steal( (Hero)enemy )) {
|
||||
state = FLEEING;
|
||||
}
|
||||
|
||||
return damage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int defenseProc(Char enemy, int damage) {
|
||||
if (state == FLEEING) {
|
||||
Dungeon.level.drop( new Gold(), pos ).sprite.drop();
|
||||
}
|
||||
|
||||
return damage;
|
||||
}
|
||||
|
||||
protected boolean steal( Hero hero ) {
|
||||
|
||||
Item item = hero.belongings.randomUnequipped();
|
||||
if (item != null) {
|
||||
|
||||
GLog.w( TXT_STOLE, this.name, item.name() );
|
||||
|
||||
item.detachAll( hero.belongings.backpack );
|
||||
this.item = item;
|
||||
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String description() {
|
||||
String desc =
|
||||
"Deeper levels of the dungeon have always been a hiding place for all kinds of criminals. " +
|
||||
"Not all of them could keep a clear mind during their extended periods so far from daylight. Long ago, " +
|
||||
"these crazy thieves and bandits have forgotten who they are and why they steal.";
|
||||
|
||||
if (item != null) {
|
||||
desc += String.format( TXT_CARRIES, Utils.capitalize( this.name ), item.name() );
|
||||
}
|
||||
|
||||
return desc;
|
||||
}
|
||||
|
||||
private class Fleeing extends Mob.Fleeing {
|
||||
@Override
|
||||
protected void nowhereToRun() {
|
||||
if (buff( Terror.class ) == null) {
|
||||
sprite.showStatus( CharSprite.NEGATIVE, TXT_RAGE );
|
||||
state = HUNTING;
|
||||
} else {
|
||||
super.nowhereToRun();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user