*/
@Override
public void onEvtSeeSpell(Skill skill, Creature character)
{
final RainbowYetiInstance actor = (RainbowYetiInstance) getActor();
final ClanHallMiniGameEvent miniGameEvent = actor.getEvent(ClanHallMiniGameEvent.class);
if (miniGameEvent == null)
{
return;
}
if (!character.isPlayer())
{
return;
}
final Player player = character.getPlayer();
CMGSiegeClanObject siegeClan = null;
final List<CMGSiegeClanObject> attackers = miniGameEvent.getObjects(SiegeEvent.ATTACKERS);
for (CMGSiegeClanObject $ : attackers)
{
if ($.isParticle(player))
{
siegeClan = $;
}
}
if (siegeClan == null)
{
return;
}
final int index = attackers.indexOf(siegeClan);
int warIndex = Integer.MIN_VALUE;
RainbowGourdInstance gourdInstance = null;
RainbowGourdInstance gourdInstance2 = null;
switch (skill.getId())
{
case 2240: // nectar
if (Rnd.chance(90))
{
gourdInstance = getGourd(index);
if (gourdInstance == null)
{
return;
}
gourdInstance.doDecrease(player);
}
else
{
actor.addMob(NpcUtils.spawnSingle(35592, actor.getX() + 10, actor.getY() + 10, actor.getZ(), 0));
}
break;
case 2241: // mineral water
warIndex = rndEx(attackers.size(), index);
if (warIndex == Integer.MIN_VALUE)
{
return;
}
gourdInstance2 = getGourd(warIndex);
if (gourdInstance2 == null)
{
return;
}
gourdInstance2.doHeal();
break;
case 2242: // water
warIndex = rndEx(attackers.size(), index);
if (warIndex == Integer.MIN_VALUE)
{
return;
}
gourdInstance = getGourd(index);
gourdInstance2 = getGourd(warIndex);
if ((gourdInstance2 == null) || (gourdInstance == null))
{
return;
}
gourdInstance.doSwitch(gourdInstance2);
break;
case 2243: // sulfur
warIndex = rndEx(attackers.size(), index);
if (warIndex == Integer.MIN_VALUE)
{
return;
}
final ZoneObject zone = miniGameEvent.getFirstObject("zone_" + warIndex);
if (zone == null)
{
return;
}
zone.setActive(true);