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(){
if (effect instanceof MissileWeapon){
((MissileWeapon) effect).level(effectLevel());
((MissileWeapon) effect).repair(100);
((MissileWeapon) effect).identify(false);
((MissileWeapon) effect).spawnedForEffect = true;
return (MissileWeapon) effect;
}
return null;
@@ -151,7 +153,9 @@ public class MindForm extends ClericSpell {
});
}
} 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,23 +126,25 @@ public class HeavyBoomerang extends MissileWeapon {
@Override
public void call() {
if (returnTarget == target){
if (!boomerang.spawnedForEffect) {
if (target instanceof Hero && boomerang.doPickUp((Hero) target)) {
//grabbing the boomerang takes no time
((Hero) target).spend(-TIME_TO_PICK_UP);
} else {
Dungeon.level.drop(boomerang, returnPos).sprite.drop();
}
}
} else if (returnTarget != null){
boomerang.circleBackhit = true;
if (((Hero)target).shoot( returnTarget, boomerang )) {
boomerang.decrementDurability();
}
if (boomerang.durability > 0) {
if (!boomerang.spawnedForEffect && boomerang.durability > 0) {
Dungeon.level.drop(boomerang, returnPos).sprite.drop();
}
} else {
} else if (!boomerang.spawnedForEffect) {
Dungeon.level.drop(boomerang, returnPos).sprite.drop();
}
CircleBack.this.next();

View File

@@ -60,6 +60,9 @@ abstract public class MissileWeapon extends Weapon {
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;
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 {
if (!curUser.shoot( enemy, this )) {
rangedMiss( cell );
@@ -307,13 +310,13 @@ abstract public class MissileWeapon extends Weapon {
return;
}
}
Dungeon.level.drop( this, cell ).sprite.drop();
if (!spawnedForEffect) Dungeon.level.drop( this, cell ).sprite.drop();
}
}
protected void rangedMiss( int cell ) {
parent = null;
super.onThrow(cell);
if (!spawnedForEffect) super.onThrow(cell);
}
public float durabilityLeft(){
@@ -501,11 +504,13 @@ abstract public class MissileWeapon extends Weapon {
return 6 * tier * quantity * (level() + 1);
}
private static final String SPAWNED = "spawned";
private static final String DURABILITY = "durability";
@Override
public void storeInBundle(Bundle bundle) {
super.storeInBundle(bundle);
bundle.put(SPAWNED, spawnedForEffect);
bundle.put(DURABILITY, durability);
}
@@ -516,6 +521,7 @@ abstract public class MissileWeapon extends Weapon {
bundleRestoring = true;
super.restoreFromBundle(bundle);
bundleRestoring = false;
spawnedForEffect = bundle.getBoolean(SPAWNED);
durability = bundle.getFloat(DURABILITY);
}

View File

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

View File

@@ -130,7 +130,7 @@ public abstract class TippedDart extends Dart {
super.rangedHit( enemy, cell);
//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.
Dart d = new Dart();
Catalog.countUse(getClass());