v3.0.0: Implemented Trinity mind form for thrown weapons

This commit is contained in:
Evan Debenham
2025-02-05 15:02:24 -05:00
parent 0bd8395d04
commit 70993f9a74
5 changed files with 26 additions and 14 deletions

View File

@@ -100,7 +100,9 @@ public class MindForm extends ClericSpell {
private MissileWeapon thrown(){ private MissileWeapon thrown(){
if (effect instanceof MissileWeapon){ if (effect instanceof MissileWeapon){
((MissileWeapon) effect).level(effectLevel()); ((MissileWeapon) effect).level(effectLevel());
((MissileWeapon) effect).repair(100);
((MissileWeapon) effect).identify(false); ((MissileWeapon) effect).identify(false);
((MissileWeapon) effect).spawnedForEffect = true;
return (MissileWeapon) effect; return (MissileWeapon) effect;
} }
return null; return null;
@@ -151,7 +153,9 @@ public class MindForm extends ClericSpell {
}); });
} }
} else if (thrown() != null){ } else if (thrown() != null){
//TODO MissileWeapon thrown = thrown();
thrown.cast(Dungeon.hero, target);
((ClassArmor)Dungeon.hero.belongings.armor()).charge -= Trinity.trinityChargeUsePerEffect(thrown.getClass());
} }
} }

View File

@@ -126,11 +126,13 @@ public class HeavyBoomerang extends MissileWeapon {
@Override @Override
public void call() { public void call() {
if (returnTarget == target){ if (returnTarget == target){
if (target instanceof Hero && boomerang.doPickUp((Hero) target)) { if (!boomerang.spawnedForEffect) {
//grabbing the boomerang takes no time if (target instanceof Hero && boomerang.doPickUp((Hero) target)) {
((Hero) target).spend(-TIME_TO_PICK_UP); //grabbing the boomerang takes no time
} else { ((Hero) target).spend(-TIME_TO_PICK_UP);
Dungeon.level.drop(boomerang, returnPos).sprite.drop(); } else {
Dungeon.level.drop(boomerang, returnPos).sprite.drop();
}
} }
} else if (returnTarget != null){ } else if (returnTarget != null){
@@ -138,11 +140,11 @@ public class HeavyBoomerang extends MissileWeapon {
if (((Hero)target).shoot( returnTarget, boomerang )) { if (((Hero)target).shoot( returnTarget, boomerang )) {
boomerang.decrementDurability(); boomerang.decrementDurability();
} }
if (boomerang.durability > 0) { if (!boomerang.spawnedForEffect && boomerang.durability > 0) {
Dungeon.level.drop(boomerang, returnPos).sprite.drop(); Dungeon.level.drop(boomerang, returnPos).sprite.drop();
} }
} else { } else if (!boomerang.spawnedForEffect) {
Dungeon.level.drop(boomerang, returnPos).sprite.drop(); Dungeon.level.drop(boomerang, returnPos).sprite.drop();
} }
CircleBack.this.next(); CircleBack.this.next();

View File

@@ -60,6 +60,9 @@ abstract public class MissileWeapon extends Weapon {
usesTargeting = true; usesTargeting = true;
} }
//whether or not this instance of the item exists purely to trigger its effect. i.e. no dropping
public boolean spawnedForEffect = false;
protected boolean sticky = true; protected boolean sticky = true;
public static final float MAX_DURABILITY = 100; public static final float MAX_DURABILITY = 100;
@@ -241,7 +244,7 @@ abstract public class MissileWeapon extends Weapon {
} }
} }
super.onThrow( cell ); if (!spawnedForEffect) super.onThrow( cell );
} else { } else {
if (!curUser.shoot( enemy, this )) { if (!curUser.shoot( enemy, this )) {
rangedMiss( cell ); rangedMiss( cell );
@@ -307,13 +310,13 @@ abstract public class MissileWeapon extends Weapon {
return; return;
} }
} }
Dungeon.level.drop( this, cell ).sprite.drop(); if (!spawnedForEffect) Dungeon.level.drop( this, cell ).sprite.drop();
} }
} }
protected void rangedMiss( int cell ) { protected void rangedMiss( int cell ) {
parent = null; parent = null;
super.onThrow(cell); if (!spawnedForEffect) super.onThrow(cell);
} }
public float durabilityLeft(){ public float durabilityLeft(){
@@ -501,11 +504,13 @@ abstract public class MissileWeapon extends Weapon {
return 6 * tier * quantity * (level() + 1); return 6 * tier * quantity * (level() + 1);
} }
private static final String SPAWNED = "spawned";
private static final String DURABILITY = "durability"; private static final String DURABILITY = "durability";
@Override @Override
public void storeInBundle(Bundle bundle) { public void storeInBundle(Bundle bundle) {
super.storeInBundle(bundle); super.storeInBundle(bundle);
bundle.put(SPAWNED, spawnedForEffect);
bundle.put(DURABILITY, durability); bundle.put(DURABILITY, durability);
} }
@@ -516,6 +521,7 @@ abstract public class MissileWeapon extends Weapon {
bundleRestoring = true; bundleRestoring = true;
super.restoreFromBundle(bundle); super.restoreFromBundle(bundle);
bundleRestoring = false; bundleRestoring = false;
spawnedForEffect = bundle.getBoolean(SPAWNED);
durability = bundle.getFloat(DURABILITY); durability = bundle.getFloat(DURABILITY);
} }

View File

@@ -43,7 +43,7 @@ public class IncendiaryDart extends TippedDart {
if ((enemy == null || enemy == curUser) && Dungeon.level.flamable[cell]) { if ((enemy == null || enemy == curUser) && Dungeon.level.flamable[cell]) {
GameScene.add(Blob.seed(cell, 4, Fire.class)); GameScene.add(Blob.seed(cell, 4, Fire.class));
decrementDurability(); decrementDurability();
if (durability > 0){ if (durability > 0 || spawnedForEffect){
super.onThrow(cell); super.onThrow(cell);
} else { } else {
Dungeon.level.drop(new Dart(), cell).sprite.drop(); Dungeon.level.drop(new Dart(), cell).sprite.drop();

View File

@@ -130,7 +130,7 @@ public abstract class TippedDart extends Dart {
super.rangedHit( enemy, cell); super.rangedHit( enemy, cell);
//need to spawn a dart //need to spawn a dart
if (durability <= 0){ if (durability <= 0 && !spawnedForEffect){
//attempt to stick the dart to the enemy, just drop it if we can't. //attempt to stick the dart to the enemy, just drop it if we can't.
Dart d = new Dart(); Dart d = new Dart();
Catalog.countUse(getClass()); Catalog.countUse(getClass());