Files
meatballcraft/scripts/CustomClickerCrimsonWill.zs
2026-07-25 16:20:42 -05:00

68 lines
2.3 KiB
Plaintext

#modloaded iceandfire
import crafttweaker.damage.IDamageSource;
import crafttweaker.entity.IEntityLivingBase;
import crafttweaker.event.PlayerInteractEntityEvent;
import mods.contenttweaker.VanillaFactory;
import mods.contenttweaker.Item;
import mods.contenttweaker.IItemRightClick;
import mods.contenttweaker.Commands;
import mods.contenttweaker.ItemFood;
import mods.contenttweaker.IItemFoodEaten;
import mods.contenttweaker.MutableItemStack;
import mods.contenttweaker.Hand;
import mods.contenttweaker.World;
import mods.contenttweaker.IItemUpdate;
import mods.contenttweaker.Player;
import crafttweaker.player.IPlayer;
import crafttweaker.block.IBlock;
import crafttweaker.data.IData;
events.onPlayerInteractEntity(function(event as PlayerInteractEntityEvent) {
if (event.world.isRemote()) {
return;
}
val heldItem = event.item;
// [edit item name in the bracket handler]
if (!isNull(heldItem) && heldItem.definition.id.matches(<contenttweaker:evertainted_pebble>.definition.id)) {
if (!event.target instanceof IEntityLivingBase) {
return;
}
val target as IEntityLivingBase = event.target;
if ((target.definition.id != "aoa3:ghostly_night_reaper") || !target.isAlive()) {
return;
}
if (!(target.mainHandHeldItem.matches(<contenttweaker:gem_of_pure_taint>))) {
return;
}
// [edit damage here]
val DAMAGE = 10000000.0f;
// [can remove this var if reusuable]
val oldHealth = target.health;
// Handle kill as if by player
if (target.health <= DAMAGE) {
target.onDeath(IDamageSource.createPlayerDamage(event.player));
// give custom drop
Commands.call("summon aoa3:night_reaper ~ ~2 ~ {HandItems:[{Count:1,id:\"contenttweaker:sundered_crimson_heart\"},{}],HandDropChances:[1.0f,0.0f],Attributes:[{Name:generic.maxHealth, Base:200000.0},{Name:generic.attackDamage, Base:400000.0}],Health:200000f,CustomName:\"Sundered Will of the Crimson Cult\"}", event.player, event.world, false, true);
// Allows for proper death
target.health = 0;
} else {
target.attackEntityFrom(<damagesource:OUT_OF_WORLD>, DAMAGE);
}
// [remove this clause if reusuable]
if (target.health < oldHealth) {
// [add anything here to handle on each successful use]
heldItem.mutable().shrink(1);
}
}
});