}
L2Skill skill = null;
int i0 = 0;
int i1 = 0;
int i2 = 0;
L2Character c2 = null;
if (c_quest2 == null)
i_quest2 = 0;
else if (!Util.checkIfInRange(5000, npc, c_quest2, true) || c_quest2.isDead())
i_quest2 = 0;
if (c_quest3 == null)
i_quest3 = 0;
else if (!Util.checkIfInRange(5000, npc, c_quest3, true) || c_quest3.isDead())
i_quest3 = 0;
if (c_quest4 == null)
i_quest4 = 0;
else if (!Util.checkIfInRange(5000, npc, c_quest4, true) || c_quest4.isDead())
i_quest4 = 0;
if (i_quest2 > i_quest3)
{
i1 = 2;
i2 = i_quest2;
c2 = c_quest2;
}
else
{
i1 = 3;
i2 = i_quest3;
c2 = c_quest3;
}
if (i_quest4 > i2)
{
i1 = 4;
i2 = i_quest4;
c2 = c_quest4;
}
if (i2 == 0)
c2 = getRandomTarget(npc);
if (i2 > 0)
{
if (Rnd.get(100) < 70)
{
if (i1 == 2)
i_quest2 = 500;
else if (i1 == 3)
i_quest3 = 500;
else if (i1 == 4)
i_quest4 = 500;
}
if (npc.getCurrentHp() > ((npc.getMaxHp() * 1) / 4))
{
i0 = 0;
i1 = 0;
if (Util.checkIfInRange(1423, npc, c2, true))
{
i0 = 1;
i1 = 1;
}
if (c2.getZ() < (npc.getZ() + 200))
{
if (Rnd.get(100) < 20)
{
skill = SkillTable.getInstance().getInfo(4690, 1);
}
else if (Rnd.get(100) < 15)
{
skill = SkillTable.getInstance().getInfo(4689, 1);
}
else if (Rnd.get(100) < 15 && i0 == 1 && i_quest0 == 1)
{
skill = SkillTable.getInstance().getInfo(4685, 1);
i_quest0 = 0;
}
else if (Rnd.get(100) < 10 && i1 == 1)
{
skill = SkillTable.getInstance().getInfo(4688, 1);
}
else if (Rnd.get(100) < 35)
{
skill = SkillTable.getInstance().getInfo(4683, 1);
}
else
{
if (Rnd.get(2) == 0) // TODO: replace me with direction, to check if player standing on left or right side of valakas
skill = SkillTable.getInstance().getInfo(4681, 1); // left hand
else
skill = SkillTable.getInstance().getInfo(4682, 1); // right hand
}
}
else if (Rnd.get(100) < 20)
{
skill = SkillTable.getInstance().getInfo(4690, 1);
}
else if (Rnd.get(100) < 15)
{
skill = SkillTable.getInstance().getInfo(4689, 1);
}
else
{
skill = SkillTable.getInstance().getInfo(4684, 1);
}
}
else if (npc.getCurrentHp() > ((npc.getMaxHp() * 2) / 4))
{
i0 = 0;
i1 = 0;
if (Util.checkIfInRange(1423, npc, c2, true))
{
i0 = 1;
i1 = 1;
}
if (c2.getZ() < (npc.getZ() + 200))
{
if (Rnd.get(100) < 5)
{
skill = SkillTable.getInstance().getInfo(4690, 1);
}
else if (Rnd.get(100) < 10)
{
skill = SkillTable.getInstance().getInfo(4689, 1);
}
else if (Rnd.get(100) < 10 && i0 == 1 && i_quest0 == 1)
{
skill = SkillTable.getInstance().getInfo(4685, 1);
i_quest0 = 0;
}
else if (Rnd.get(100) < 10 && i1 == 1)
{
skill = SkillTable.getInstance().getInfo(4688, 1);
}
else if (Rnd.get(100) < 20)
{
skill = SkillTable.getInstance().getInfo(4683, 1);
}
else
{
if (Rnd.get(2) == 0) // TODO: replace me with direction, to check if player standing on left or right side of valakas
skill = SkillTable.getInstance().getInfo(4681, 1); // left hand
else
skill = SkillTable.getInstance().getInfo(4682, 1); // right hand
}
}
else if (Rnd.get(100) < 5)
{
skill = SkillTable.getInstance().getInfo(4690, 1);
}
else if (Rnd.get(100) < 10)
{
skill = SkillTable.getInstance().getInfo(4689, 1);
}
else
{
skill = SkillTable.getInstance().getInfo(4684, 1);
}
}
else if (npc.getCurrentHp() > ((npc.getMaxHp() * 3) / 4.0))
{
i0 = 0;
i1 = 0;
if (Util.checkIfInRange(1423, npc, c2, true))
{
i0 = 1;
i1 = 1;
}
if (c2.getZ() < (npc.getZ() + 200))
{
if (Rnd.get(100) < 0)
{
skill = SkillTable.getInstance().getInfo(4690, 1);
}
else if (Rnd.get(100) < 5)
{
skill = SkillTable.getInstance().getInfo(4689, 1);
}
else if (Rnd.get(100) < 5 && i0 == 1 && i_quest0 == 1)
{
skill = SkillTable.getInstance().getInfo(4685, 1);
i_quest0 = 0;
}
else if (Rnd.get(100) < 10 && i1 == 1)
{
skill = SkillTable.getInstance().getInfo(4688, 1);
}
else if (Rnd.get(100) < 15)
{
skill = SkillTable.getInstance().getInfo(4683, 1);
}
else
{
if (Rnd.get(2) == 0) // TODO: replace me with direction, to check if player standing on left or right side of valakas
skill = SkillTable.getInstance().getInfo(4681, 1); // left hand
else
skill = SkillTable.getInstance().getInfo(4682, 1); // right hand
}
}
else if (Rnd.get(100) < 0)
{
skill = SkillTable.getInstance().getInfo(4690, 1);
}
else if (Rnd.get(100) < 5)
{
skill = SkillTable.getInstance().getInfo(4689, 1);
}
else
{
skill = SkillTable.getInstance().getInfo(4684, 1);
}
}
else
{
i0 = 0;
i1 = 0;
if (Util.checkIfInRange(1423, npc, c2, true))
{
i0 = 1;
i1 = 1;
}
if (c2.getZ() < (npc.getZ() + 200))
{
if (Rnd.get(100) < 0)
{
skill = SkillTable.getInstance().getInfo(4690, 1);
}