* @param caster Creature
*/
@Override
protected void onEvtSeeSpell(Skill skill, Creature caster)
{
final SquashInstance actor = getActor();
if ((actor == null) || (skill.getId() != 2005))
{
return;
}
switch (_tryCount)
{
case 0:
_tryCount++;
_lastNectarUse = System.currentTimeMillis();
if (Rnd.chance(50))
{
_nectar++;
Functions.npcSay(actor, textSuccess0[Rnd.get(textSuccess0.length)]);
actor.broadcastPacket(new MagicSkillUse(actor, actor, Squash_Level_up, 1, NECTAR_REUSE, 0));
}
else
{
Functions.npcSay(actor, textFail0[Rnd.get(textFail0.length)]);
actor.broadcastPacket(new MagicSkillUse(actor, actor, Squash_Poisoned, 1, NECTAR_REUSE, 0));
}
break;
case 1:
if ((System.currentTimeMillis() - _lastNectarUse) < NECTAR_REUSE)
{
Functions.npcSay(actor, textTooFast[Rnd.get(textTooFast.length)]);
return;
}
_tryCount++;
_lastNectarUse = System.currentTimeMillis();
if (Rnd.chance(50))
{
_nectar++;
Functions.npcSay(actor, textSuccess1[Rnd.get(textSuccess1.length)]);
actor.broadcastPacket(new MagicSkillUse(actor, actor, Squash_Level_up, 1, NECTAR_REUSE, 0));
}
else
{
Functions.npcSay(actor, textFail1[Rnd.get(textFail1.length)]);
actor.broadcastPacket(new MagicSkillUse(actor, actor, Squash_Poisoned, 1, NECTAR_REUSE, 0));
}
break;
case 2:
if ((System.currentTimeMillis() - _lastNectarUse) < NECTAR_REUSE)
{
Functions.npcSay(actor, textTooFast[Rnd.get(textTooFast.length)]);
return;
}
_tryCount++;
_lastNectarUse = System.currentTimeMillis();
if (Rnd.chance(50))
{
_nectar++;
Functions.npcSay(actor, textSuccess2[Rnd.get(textSuccess2.length)]);
actor.broadcastPacket(new MagicSkillUse(actor, actor, Squash_Level_up, 1, NECTAR_REUSE, 0));
}
else
{
Functions.npcSay(actor, textFail2[Rnd.get(textFail2.length)]);
actor.broadcastPacket(new MagicSkillUse(actor, actor, Squash_Poisoned, 1, NECTAR_REUSE, 0));
}
break;
case 3:
if ((System.currentTimeMillis() - _lastNectarUse) < NECTAR_REUSE)
{
Functions.npcSay(actor, textTooFast[Rnd.get(textTooFast.length)]);
return;
}
_tryCount++;
_lastNectarUse = System.currentTimeMillis();
if (Rnd.chance(50))
{
_nectar++;
Functions.npcSay(actor, textSuccess3[Rnd.get(textSuccess3.length)]);
actor.broadcastPacket(new MagicSkillUse(actor, actor, Squash_Level_up, 1, NECTAR_REUSE, 0));
}
else
{
Functions.npcSay(actor, textFail3[Rnd.get(textFail3.length)]);
actor.broadcastPacket(new MagicSkillUse(actor, actor, Squash_Poisoned, 1, NECTAR_REUSE, 0));
}
break;
case 4:
if ((System.currentTimeMillis() - _lastNectarUse) < NECTAR_REUSE)
{
Functions.npcSay(actor, textTooFast[Rnd.get(textTooFast.length)]);
return;
}
_tryCount++;
_lastNectarUse = System.currentTimeMillis();
if (Rnd.chance(50))
{
_nectar++;
Functions.npcSay(actor, textSuccess4[Rnd.get(textSuccess4.length)]);
actor.broadcastPacket(new MagicSkillUse(actor, actor, Squash_Level_up, 1, NECTAR_REUSE, 0));
}
else
{
Functions.npcSay(actor, textFail4[Rnd.get(textFail4.length)]);
actor.broadcastPacket(new MagicSkillUse(actor, actor, Squash_Poisoned, 1, NECTAR_REUSE, 0));
}
if (_npcId == Young_Squash)
{
if (_nectar < 3)
{