|
板凳
![](static/image/common/ico_lz.png)
楼主 |
发表于 2013-11-24 19:57:28
|
只看该作者
function SorceressCast(target, isBoss, index, maxAttacks, conviction)
{
var _iAttack = 0;
var _iRetry = 0;
var _attacks = isBoss ? 8 : (MyConfig_AttackSkill[index][0] == 64) ? 2 : (MyConfig_AttackSkill[index][0] == 49 || MyConfig_AttackSkill[index][0] == 53) ? 3 : 4;
var _isFailure = false;
var _option1 = { target: target, boss: isBoss, index: index, flying: !isBoss && My.Unit.IsFlying(target), vulture: !isBoss && My.Unit.IsVulture(target) };
var _option2 = { target: target, boss: false, index: index + 1, flying: _option1.flying, vulture: _option1.vulture };
var _targetHp = target.hp;
while (My.Unit.CheckLife(target))
{
if (_iAttack > maxAttacks && maxAttacks > 0)
return false;
if (MyConfig_AttackSkill[index][0] != 42)
{
if (!MyConfig_TravincalSafe || _isFailure)
{
if (!My.Attack.Collision(_option1))
return false;
}
else
SorceressTravincalCollision(_option1);
}
if ((_iAttack % 3) == 0)
My.Precast.CheckPrecast(1);
if (conviction > 1)
{
if (!My.Attack.CheckConvictionResistance(target, index, conviction, _iAttack > 2))
return false;
}
if (_iAttack == 0 && index > 0)
My.Attack.SorceressStaticField(target, MyConfig_SorceressStaticKeep[isBoss ? 0 : 1], MyConfig_SorceressStaticSkip[isBoss ? 0 : 1], MyConfig_SorceressStaticUse[isBoss ? 0 : 1]);
if (!My.Unit.CheckLife(target))
return true;
if (MyConfig_AttackSkill[index][0] != 42)
{
NTC_SwapWeapons(0);
NTC_CastSkill(MyConfig_AttackSkill[index][0], My.Attack.skillHand[index], target);
}
else
My.Attack.SorceressStaticField(target, MyConfig_SorceressStaticKeep[isBoss ? 0 : 1], MyConfig_SorceressStaticSkip[isBoss ? 0 : 1], MyConfig_SorceressStaticSkill, (index > 0) ? 65535 : 1);
if (index == 0)
return !My.Unit.CheckLife(target);
if (MyConfig_AttackSkill[index + 1][0] > -1 && My.Attack.GetResistance(target, My.Attack.skillDamage[index + 1]) < 100)
{
if (MyConfig_AttackSkill[index + 1][0] != 42)
{
while (me.GetSkillStatus(MyConfig_AttackSkill[index][0]) == 8 || (MyConfig_SorceressStaticSkill > 0 && MyConfig_AttackSkill[index][0] == 42 && Math.floor(target.hp * 100 / target.hpmax) < MyConfig_SorceressStaticSkill))
{
if (!My.Unit.CheckLife(target))
return true;
if (!MyConfig_TravincalSafe)
{
if (!My.Attack.Collision(_option2))
break;
}
else
SorceressTravincalCollision(_option2);
if (me.GetSkillStatus(MyConfig_AttackSkill[index + 1][0]) != 8)
{
NTC_SwapWeapons(0);
NTC_CastSkill(MyConfig_AttackSkill[index + 1][0], My.Attack.skillHand[index + 1], target);
}
else
Delay(NTC_DELAY_FRAME);
}
}
else
My.Attack.SorceressStaticField(target, MyConfig_SorceressStaticKeep[isBoss ? 0 : 1], MyConfig_SorceressStaticSkip[isBoss ? 0 : 1], MyConfig_SorceressStaticSkill, 65535, MyConfig_AttackSkill[index][0]);
}
while (me.GetSkillStatus(MyConfig_AttackSkill[index][0]) == 8)
{
if (!My.Unit.CheckLife(target))
return true;
Delay(NTC_DELAY_FRAME);
}
if ((++_iAttack % _attacks) == 0 && maxAttacks > 0)
{
if (target.hp < _targetHp)
{
_isFailure = false;
_targetHp = target.hp;
}
else if (_iRetry++ < (isBoss ? 2 : 1))
{
if (!My.Move.MoveTo(target.areaid, target.x, target.y, 0))
return false;
_isFailure = true;
}
else
return false;
}
}
return true;
}
function SorceressTravincalCollision(option)
{
var _countMonster1 = [[0, My.Attack.travincalWaypoint.x + 97, My.Attack.travincalWaypoint.y - 91], [0, My.Attack.travincalWaypoint.x + 70, My.Attack.travincalWaypoint.y - 81], [0, My.Attack.travincalWaypoint.x + 72, My.Attack.travincalWaypoint.y - 102]];
var _countMonster2 = [[0, My.Attack.travincalWaypoint.x + 63, My.Attack.travincalWaypoint.y - 65], [0, My.Attack.travincalWaypoint.x + 92, My.Attack.travincalWaypoint.y - 65]];
var _countMonster3 = [[0, My.Attack.travincalWaypoint.x + 85, My.Attack.travincalWaypoint.y - 65], [0, My.Attack.travincalWaypoint.x + 115, My.Attack.travincalWaypoint.y - 65]];
var i;
var _unit;
var _unitX, _unitY, _location;
if (option.target.x >= (My.Attack.travincalWaypoint.x + 68) && option.target.y >= (My.Attack.travincalWaypoint.y - 102) && option.target.x <= (My.Attack.travincalWaypoint.x + 108) && option.target.y <= (My.Attack.travincalWaypoint.y - 81))
_location = (option.target.x >= (My.Attack.travincalWaypoint.x + 90) && option.target.y >= (My.Attack.travincalWaypoint.y - 87)) ? 3 : 1;
else if (option.target.y <= (My.Attack.travincalWaypoint.y - 58))
_location = (option.target.x <= (My.Attack.travincalWaypoint.x + 90)) ? 2 : 3;
else
return My.Attack.Collision(option);
_unit = NTC_FindUnit(NTC_UNIT_MONSTER);
if (_unit)
{
do
{
if ((_unit.classid == 345 || _unit.classid == 346) && My.Unit.CheckLife(_unit))
{
_unitX = _unit.x;
_unitY = _unit.y;
switch (_location)
{
case 1:
for (i = 0; i < _countMonster1.length; i++)
{
if (GetDistance(_unitX, _unitY, _countMonster1[1], _countMonster1[2]) <= 7)
_countMonster1[0]++;
}
break;
case 2:
for (i = 0; i < _countMonster2.length; i++)
{
if (GetDistance(_unitX, _unitY, _countMonster2[1], _countMonster2[2]) <= 7)
_countMonster2[0]++;
}
break;
case 3:
for (i = 0; i < _countMonster3.length; i++)
{
if (GetDistance(_unitX, _unitY, _countMonster3[1], _countMonster3[2]) <= 7)
_countMonster3[0]++;
}
break;
}
}
} while (_unit.GetNext());
}
switch (_location)
{
case 1: _countMonster1.sort(My.Common.SortAscending); return My.Move.MoveTo(me.areaid, _countMonster1[0][1], _countMonster1[0][2]);
case 2: _countMonster2.sort(My.Common.SortAscending); return My.Move.MoveTo(me.areaid, _countMonster2[0][1], _countMonster2[0][2]);
case 3: _countMonster3.sort(My.Common.SortAscending); return My.Move.MoveTo(me.areaid, _countMonster3[0][1], _countMonster3[0][2]);
}
} |
|