--[[
--------------------------------------------------
Copied and modified the original chanter script
--------------------------------------------------
]]--
--- (Private Function) Check required healing for the entity.
--
-- @
Entity Entity to check.
-- @
IsPriority Indicates only priority healing to be executed.
-- @
bool
function _Heal( Entity, IsPriority )
-- Retrieve the rechargeable health.
local HealthRecharge = Entity:GetHealthMaximum() - Entity:GetHealthMaximum();
-- Retrieve the state.
local EntityState = Entity:GetState();
-- Heal 1: Recovery Magic
if Helper:CheckAvailable( "Recovery Magic" ) and (( IsPriority and HealthRecharge >= 2526 ) or ( not IsPriority and Entity:GetHealth() < 60 )) then
Helper:CheckExecute( "Recovery Magic", Entity );
return false;
end
-- Heal 2: Stamina Recovery
if Entity:GetID() == Player:GetID() and Helper:CheckAvailable( "Stamina Restoration" ) and (( IsPriority and Entity:GetHealth() < 40 ) or ( not IsPriority and Entity:GetHealth() < 50 )) then
Helper:CheckExecute( "Stamina Restoration" );
return false;
end
if Player:GetManaCurrent() < 4500 and Helper:CheckAvailable( "Stamina Restoration" ) then
Helper:CheckExecute( "Stamina Restoration" );
return false;
end
-- Heal 3: Healing Burst
if Helper:CheckAvailable( "Healing Burst" ) and (( IsPriority and Entity:GetHealth() < 40 ) or ( not IsPriority and Entity:GetHealth() < 50 )) then
Helper:CheckExecute( "Healing Burst", Entity );
return false;
end
-- Heal 4: Healing Light
if EntityState:GetState( Helper:CheckName( "Recovery Magic" )) == nil and Helper:CheckAvailable( "Healing Light" ) and (( IsPriority and Entity:GetHealth() < 50 ) or ( not IsPriority and Entity:GetHealth() < 60 )) then
Helper:CheckExecute( "Healing Light", Entity );
return false;
end
end
--- Perform the attack routine on the selected target.
--
-- @
Entity Contains the entity we have targeted.
-- @
double Contains the distance to the target
-- @
bool Indicates whether or not the target is stunned.
-- @
bool
function Attack( Entity, Range, Stunned )
-----------------------------------
--BUFF Food Checks / Scrolls;
if Settings.CritFood then
self:CheckCritFood();
end
if Settings.AttackFood then
self:CheckAttackFood();
end
if Settings.NaturalHeal then
self:CheckNaturalHeal();
end
if Settings.AttackScroll then
self:CheckAttackScroll();
end
if Settings.RunScroll then
self:CheckRunScroll();
end
-----------------------------------
-- Prepare the attack timer when the target is stunned to determine when to use Soul Crush.
if Stunned and self.AttackTimer == nil then
self.AttackTimer = Time() + 750;
elseif not Stunned then
self.AttackTimer = nil;
end
--
-- Binding Word (Physical Charged Attack)
--
local EntityState = Player:GetState();
if Helper:CheckAvailable( "Word of Inspiration" ) and EntityState:GetState( "Word of Inspiration" ) == nil then
Helper:CheckExecute( "Word of Inspiration" );
return false;
end
if Helper:CheckAvailable( "Elemental Screen" ) and EntityState:GetState( "Elemental Screen" ) == nil then
Helper:CheckExecute( "Elemental Screen" );
return false;
end
if Helper:CheckAvailable( "Divine Curtain" ) and EntityState:GetState( "Divine Curtain" ) == nil then
Helper:CheckExecute( "Divine Curtain" );
return false;
end
if Helper:CheckAvailable( "Magic Acceleration" ) and EntityState:GetState( "Magic Acceleration" ) == nil then
Helper:CheckExecute( "Magic Acceleration" );
return false;
end
--------------------------------------------------
-- H E A L I N G --
--------------------------------------------------
self:_Heal( Player, true );
--------------------------------------------------
-- C H A I N A T T A C K (S) --
--------------------------------------------------
-- Chain Attack 1: Remove Shock
if not Stunned and Helper:CheckAvailable( "Backshock" ) and ( not Helper:CheckAvailable( "Retribution" ) or Range <= 10 ) then
Helper:CheckExecute( "Backshock" );
return false;
elseif not Stunned and Helper:CheckAvailable( "Retribution" ) then
Helper:CheckExecute( "Retribution" );
return false;
elseif Helper:CheckAvailable( "Remove Shock" ) then
Helper:CheckExecute( "Remove Shock" );
return false;
end
-- Chain Attack 2: Meteor Strike
if Helper:CheckAvailable( "Pentacle Shock" ) then
Helper:CheckExecute( "Pentacle Shock" );
return false;
elseif Helper:CheckAvailable( "Incandescent Blow" ) then
Helper:CheckExecute( "Incandescent Blow" );
return false;
end
-- Chain Attack 4 Part I: Hallowed Strike
if Helper:CheckAvailable( "Booming Smash" ) then
Helper:CheckExecute( "Booming Smash" );
return false;
elseif Helper:CheckAvailable( "Booming Assault" ) then
Helper:CheckExecute( "Booming Assault" );
return false;
end
-- Chain Attack 3: Infernal Blaze (Parrying Strike, if available, is preferred).
if not Stunned and Helper:CheckAvailable( "Parrying Strike" ) and Helper:CheckAvailable( "Infernal Blaze" ) then
Helper:CheckExecute( "Parrying Strike" );
return false;
elseif not Stunned and Helper:CheckAvailable( "Infernal Blaze" ) then
Helper:CheckExecute( "Infernal Blaze" );
return false;
end
-- Chain Attack 4 Part II: Hallowed Strike
if Helper:CheckAvailable( "Booming Strike" ) then
Helper:CheckExecute( "Booming Strike" );
return false;
end
--------------------------------------------------
-- C O N D I T I O N A L A T T A C K (S) --
--------------------------------------------------
-- Conditional Attack 1: Seismic Crash
if Helper:CheckAvailable( "Seismic Crash" ) then
Helper:CheckExecute( "Seismic Crash" );
return false;
end
-- Conditional Attack 2: Resonance Haze
if Helper:CheckAvailable( "Resonance Haze" ) then
Helper:CheckExecute( "Resonance Haze" );
return false;
end
-- Conditional Attack 3: Soul Lock
if Helper:CheckAvailable( "Soul Lock" ) then
Helper:CheckExecute( "Soul Lock" );
return false;
end
-- Conditional Attack 4: Parrying Strike
if not Stunned and Helper:CheckAvailable( "Parrying Strike" ) then
Helper:CheckExecute( "Parrying Strike" );
return false;
end
-- Conditional Attack 5: Soul Crush
if self.AttackTimer ~= nil and self.AttackTimer < Time() and Helper:CheckAvailable( "Soul Crush" ) then
Helper:CheckExecute( "Soul Crush" );
return false;
end
--------------------------------------------------
-- P R E P A R I N G A T T A C K (S) --
--------------------------------------------------
-- When the entity is a player ...
if Entity:IsPlayer() then
if Helper:CheckAvailable( "Word of Wind" ) and Player:GetDP() >=2000 then
Helper:CheckExecute( "Word of Wind");
return false;
elseif Helper:CheckAvailable( "Divine Protection" ) and Player:GetDP() >=4000 then
Helper:CheckExecute( "Divine Protection");
return false;
end
-- Preparing Attack 1: Confident Defense
if Helper:CheckAvailable( "Confident Defense" ) then
Helper:CheckExecute( "Confident Defense" );
return false;
end
-- Preparing Attack 2: Protective Ward
if Helper:CheckAvailable( "Protective Ward" ) then
Helper:CheckExecute( "Protective Ward" );
return false;
end
-- Preparing Attack 3: Marchutan's Protection/Yustiel's Protection
if Player:GetDP() >= 2000 then
if Helper:CheckAvailable( "Marchutan's Protection" ) then
Helper:CheckExecute( "Marchutan's Protection" );
return false;
elseif Helper:CheckAvailable( "Yustiel's Protection" ) then
Helper:CheckExecute( "Yustiel's Protection" );
return false;
end
end
-- Otherwise when the entity is not a player ...
else
-- Preparing Attack 4: Word of Revival (Also in Pause)
if Player:GetHealthCurrent() < Player:GetHealthMaximum() and Player:GetState():GetState( Helper:CheckName( "Word of Life" )) == nil and Helper:CheckAvailable( "Word of Life" ) then
Helper:CheckExecute( "Word of Life", Player );
return false;
end
end
--------------------------------------------------
-- H E A L I N G --
--------------------------------------------------
self:_Heal( Player, false );
--------------------------------------------------
-- R A N G E D A T T A C K (S) --
--------------------------------------------------
-- Ranged Attack 1: Inescapable Judgement/Soul Strike and Retribution (Chain Skill)
if not Stunned and Helper:CheckAvailable( "Inescapable Judgment" ) then
Helper:CheckExecute( "Inescapable Judgment" );
return false;
elseif not Stunned and Helper:CheckAvailable( "Soul Strike" ) then
Helper:CheckExecute( "Soul Strike" );
return false;
end
--------------------------------------------------
-- N O R M A L A T T A C K (S) --
--------------------------------------------------
-- Normal Attack 1: Mountain Crash
if Helper:CheckAvailable( "Mountain Crash" ) then
Helper:CheckExecute( "Mountain Crash" );
return false;
end
-- Normal Attack 2: Disorienting Blow
if not Stunned and Helper:CheckAvailable( "Disorienting Blow" ) then
Helper:CheckExecute( "Disorienting Blow" );
return false;
end
-- Normal Attack 3: Numbing Blow
if not Stunned and Helper:CheckAvailable( "Numbing Blow" ) then
Helper:CheckExecute( "Numbing Blow" );
return false;
end
--------------------------------------------------
-- I N I T I A L A T T A C K (S) --
--------------------------------------------------
-- Initial Attack 1: Automatic Attack
if self.AttackStarted ~= Entity:GetID() then
self.AttackStarted = Entity:GetID();
Helper:CheckExecute( "Attack/Chat" );
return false;
end
-- Initial Attack 2: Meteor Strike
if Helper:CheckAvailable( "Meteor Strike" ) then
Helper:CheckExecute( "Meteor Strike" );
return false;
end
-- Initial Attack 3: Hallowed Strike
if Helper:CheckAvailable( "Hallowed Strike" ) then
Helper:CheckExecute( "Hallowed Strike" );
return false;
end
-- Nothing was executed, continue with other functions.
return true;
end
--- Perform healing checks both in and our of combat.
--
-- @
bool Indicates whether or not the function is running before force checks.
-- @
bool
function Heal( BeforeForce )
-- Nothing was executed, continue with other functions.
return true;
end
function Force()
-- Retrieve the entity for the current force member.
local partyE = EntityList:GetEntity( "Xenilraydan" );
if partyE ~= nil then
local Range = Player:GetPosition()
istanceToPosition( partyE:GetPosition());
if partyE:GetHealth() < 60 and Range <= 23 then
if Helper:CheckAvailable( "Recovery Magic" ) then
Helper:CheckExecute( "Recovery Magic", partyE );
return false;
end
end
if partyE:GetHealth() < 30 and Range <= 23 then
if Helper:CheckAvailable( "Healing Burst" ) then
Helper:CheckExecute( "Healing Burst", partyE );
return false;
end
end
if partyE:GetHealth() < 20 and Range <= 23 then
if Helper:CheckAvailable( "Healing Light" ) then
Helper:CheckExecute( "Healing Light", partyE );
return false;
end
end
end
return true;
end
--- Perform the safety checks before moving to the next target.
--
-- @
bool
function Pause()
if DialogList:GetDialog( "loot_roll_dialog" ):IsVisible() then
DialogList:GetDialog( "loot_roll_dialog/abandon" ):click()
end
--------------------------------------------------
-- H E A L I N G --
--------------------------------------------------
-- Heal 5: Word of Revival (Also in Attack)
if Player:GetHealthCurrent() < Player:GetHealthMaximum() and Player:GetState():GetState( Helper:CheckName( "Word of Life" )) == nil and Helper:CheckAvailable( "Word of Life" ) then
Helper:CheckExecute( "Word of Life", Player );
return false;
end
-- Heal 6: Magic Recovery
if Helper:CheckAvailable( "Magic Recovery" ) and Player:GetManaCurrent() < Player:GetManaMaximum() - 2500 then
Helper:CheckExecute( "Magic Recovery", Player );
return false;
end
-- Heal 0: Non-Priority Healing
self:_Heal( Player, false );
--------------------------------------------------
-- B U F F I N G --
--------------------------------------------------
-- Check if the state checking timer has expired.
if ( self.StateBuffTime == nil or self.StateBuffTime < Time()) then
-- Retrieve the state.
local EntityState = Player:GetState();
-- Buff 3: Promise of Wind
if Helper:CheckAvailable( "Promise of Earth" ) and EntityState:GetState( Helper:CheckName( "Promise of Earth" )) == nil then
Helper:CheckExecute( "Promise of Earth", Player );
return false;
end
-- Buff 3: Blessing of Wind. IDK BUFFING DONT WORKING
--if Helper:CheckAvailable( "Prayer of Protection" ) and EntityState:GetState( Helper:CheckName( "Prayer of Protection 5" )) == nil then
-- Helper:CheckExecute( "Prayer of Protection", Player );
-- return false;
--end
-- Buff 4: Rage Spell
if Helper:CheckAvailable( "Rage Spell" ) and EntityState:GetState( "Rage Spell" ) == nil then
Helper:CheckExecute( "Rage Spell", Player );
return false;
end
-- Update the state checking timer.
self.StateBuffTime = Time() + 1000;
end
-- Nothing was executed, continue with other functions.
return true;
end
---------------Buff Scrolls-------------
function CheckCritFood()
stateID = {10224,10225,9976,9989,10051,10064};
foodName = {"Calydon Meat Dumpling","Wild Ginseng Pickle","Tasty Calydon Meat Dumpling","Tasty Wild Ginseng Pickle","Innesi Herb Dumpling","Poma Wine Herb Dumpling","Tasty Innesi Herb Dumpling","Tasty Poma Wine Herb Dumpling"};
flag = 0;
for _,v in ipairs(stateID) do
if Player:GetState():GetState( v ) ~= nil then
flag = flag + 1;
end
end
if flag == 0 then
for a,b in ipairs(foodName) do
if Helper:CheckAvailableInventory( b ) then
PlayerInput:Inventory( b );
break;
end
end
end
return true;
end
--------------------------------
function CheckAttackFood()
stateID = {10051,10064,10224,10225,9976,9989};
foodName = {"Minor Focus Agent","Lesser Focus Agent","Focus Agent","Greater Focus Agent","Major Focus Agent","Fine Focus Agent"};
flag = 0;
for _,v in ipairs(stateID) do
if Player:GetState():GetState( v ) ~= nil then
flag = flag + 1;
end
end
if flag == 0 then
for a,b in ipairs(foodName) do
if Helper:CheckAvailableInventory( b ) then
PlayerInput:Inventory( b );
break;
end
end
end
return true;
end
-----------------------------------
function CheckNaturalHeal()
stateID = {10044,10094};
foodName = {"Minor Rally Serum","Lesser Rally Serum","Rally Serum","Greater Rally Serum","Major Rally Serum","Fine Rally Serum","Tasty Ormea Cocktail"};
flag = 0;
for _,v in ipairs(stateID) do
if Player:GetState():GetState( v ) ~= nil then
flag = flag + 1;
end
end
if flag == 0 then
for a,b in ipairs(foodName) do
if Helper:CheckAvailableInventory( b ) then
PlayerInput:Inventory( b );
break;
end
end
end
return true;
end
-------------------------------------
function CheckAttackScroll()
stateID = {9959};
foodName = {"Courage Scroll"};
flag = 0;
for _,v in ipairs(stateID) do
if Player:GetState():GetState( v ) ~= nil then
flag = flag + 1;
end
end
if flag == 0 then
for a,b in ipairs(foodName) do
if Helper:CheckAvailableInventory( b ) then
PlayerInput:Inventory( b );
break;
end
end
end
return true;
end
--------------------------
function CheckRunScroll()
stateID = {9960};
foodName = {"Running Scroll"};
flag = 0;
for _,v in ipairs(stateID) do
if Player:GetState():GetState( v ) ~= nil then
flag = flag + 1;
end
end
if flag == 0 then
for a,b in ipairs(foodName) do
if Helper:CheckAvailableInventory( b ) then
PlayerInput:Inventory( b );
break;
end
end
end
return true;
end