use of com.teamwizardry.wizardry.api.spell.IContinuousModule in project Wizardry by TeamWizardry.
the class EventHandler method fairyAmbush.
@SubscribeEvent
public void fairyAmbush(SpellCastEvent event) {
Entity caster = event.getSpellData().getData(SpellData.DefaultKeys.CASTER);
int chance = 5;
for (SpellRing spellRing : SpellUtils.getAllSpellRings(event.getSpellRing())) if (spellRing instanceof IContinuousModule) {
chance = 1000;
break;
}
if (RandUtil.nextInt(chance) == 0 && caster != null) {
List<EntityFairy> fairyList = event.getSpellData().world.getEntitiesWithinAABB(EntityFairy.class, new AxisAlignedBB(caster.getPosition()).grow(64, 64, 64));
if (fairyList.isEmpty())
return;
EntityFairy fairy = fairyList.get(RandUtil.nextInt(fairyList.size() - 1));
if (fairy == null)
return;
fairy.ambush = true;
}
}
Aggregations