mirror of
https://github.com/SWG-Source/dsrc.git
synced 2026-07-31 00:15:54 -04:00
660 lines
19 KiB
Plaintext
660 lines
19 KiB
Plaintext
include library.armor;
|
|
include library.jedi;
|
|
include library.utils;
|
|
include library.healing;
|
|
include library.dot;
|
|
include library.combat;
|
|
include library.prose;
|
|
include library.anims;
|
|
include library.ai_lib;
|
|
include library.vehicle;
|
|
include library.buff;
|
|
include library.stealth;
|
|
|
|
const int DAMAGE = 0;
|
|
const int WOUNDS = 1;
|
|
const int BATTLE_FATIGUE = NUM_ATTRIBUTES;
|
|
const int STATES = 10;
|
|
const int BLEEDING = 11;
|
|
const int DISEASE = 12;
|
|
const int POISON = 13;
|
|
|
|
const string[] STAT_STRINGS = {"health", "constitution", "action", "stamina", "mind", "willpower", "battle_fatigue"};
|
|
|
|
const string[] STAT_TYPE = {"damage", "wounds"};
|
|
|
|
|
|
|
|
void doJediHealingSpam(int intStat, int intDamageType, int intAmount, obj_id objPlayer, obj_id objTarget)
|
|
{
|
|
if (intStat < NUM_ATTRIBUTES)
|
|
{
|
|
string strTest = STAT_STRINGS[intStat];
|
|
strTest = strTest + "_"+STAT_TYPE[intDamageType];
|
|
string_id strStat = new string_id("jedi_spam", strTest);
|
|
if(objTarget!=objPlayer)
|
|
{
|
|
string_id strSpam = new string_id("jedi_spam", "heal_other_self");
|
|
prose_package proseTest = prose.getPackage(strSpam, null, objTarget, strStat, intAmount);
|
|
sendSystemMessageProse(objPlayer, proseTest);
|
|
if(isPlayer(objTarget))
|
|
{
|
|
strSpam = new string_id("jedi_spam", "heal_other_other");
|
|
proseTest = prose.getPackage(strSpam, null, objPlayer, strStat, intAmount);
|
|
sendSystemMessageProse(objTarget, proseTest);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
string_id strSpam = new string_id("jedi_spam", "heal_self");
|
|
prose_package proseTest = prose.getPackage(strSpam, objPlayer, null, strStat, intAmount);
|
|
sendSystemMessageProse(objPlayer, proseTest);
|
|
}
|
|
}
|
|
else if(intStat==BATTLE_FATIGUE)
|
|
{
|
|
string strTest = STAT_STRINGS[intStat];
|
|
string_id strStat = new string_id("jedi_spam", strTest);
|
|
if(objTarget!=objPlayer)
|
|
{
|
|
string_id strSpam = new string_id("jedi_spam", "heal_other_self");
|
|
prose_package proseTest = prose.getPackage(strSpam, null, objTarget, strStat, intAmount);
|
|
sendSystemMessageProse(objPlayer, proseTest);
|
|
if(isPlayer(objTarget))
|
|
{
|
|
strSpam = new string_id("jedi_spam", "heal_other_other");
|
|
proseTest = prose.getPackage(strSpam, null, objPlayer, strStat, intAmount);
|
|
sendSystemMessageProse(objTarget, proseTest);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
string_id strSpam = new string_id("jedi_spam", "heal_self");
|
|
prose_package proseTest = prose.getPackage(strSpam, objPlayer, null, strStat, intAmount);
|
|
sendSystemMessageProse(objPlayer, proseTest);
|
|
}
|
|
}
|
|
else if(intStat==BLEEDING)
|
|
{
|
|
if(objPlayer!=objTarget)
|
|
{
|
|
if(intAmount<0)
|
|
{
|
|
string_id strSpam = new string_id("jedi_spam", "stop_bleeding_other");
|
|
prose_package proseTest = prose.getPackage(strSpam, objTarget);
|
|
sendSystemMessageProse(objPlayer, proseTest);
|
|
}
|
|
else
|
|
{
|
|
string_id strSpam = new string_id("jedi_spam", "staunch_bleeding_other");
|
|
prose_package proseTest = prose.getPackage(strSpam, objTarget);
|
|
sendSystemMessageProse(objPlayer, proseTest);
|
|
}
|
|
}
|
|
}
|
|
else if(intStat==STATES)
|
|
{
|
|
if(objPlayer!=objTarget)
|
|
{
|
|
if(intAmount<0)
|
|
{
|
|
string_id strSpam = new string_id("jedi_spam", "stop_states_other");
|
|
prose_package proseTest = prose.getPackage(strSpam, objTarget);
|
|
sendSystemMessageProse(objPlayer, proseTest);
|
|
}
|
|
}
|
|
}
|
|
else if(intStat==DISEASE)
|
|
{
|
|
if(objPlayer!=objTarget)
|
|
{
|
|
if(intAmount<0)
|
|
{
|
|
string_id strSpam = new string_id("jedi_spam", "stop_disease_other");
|
|
prose_package proseTest = prose.getPackage(strSpam, objTarget);
|
|
sendSystemMessageProse(objPlayer, proseTest);
|
|
}
|
|
else
|
|
{
|
|
string_id strSpam = new string_id("jedi_spam", "staunch_disease_other");
|
|
prose_package proseTest = prose.getPackage(strSpam, objTarget);
|
|
sendSystemMessageProse(objPlayer, proseTest);
|
|
}
|
|
}
|
|
}
|
|
else if(intStat==POISON)
|
|
{
|
|
if(objPlayer!=objTarget)
|
|
{
|
|
if(intAmount<0)
|
|
{
|
|
string_id strSpam = new string_id("jedi_spam", "stop_poison_other");
|
|
prose_package proseTest = prose.getPackage(strSpam, objTarget);
|
|
sendSystemMessageProse(objPlayer, proseTest);
|
|
}
|
|
else
|
|
{
|
|
string_id strSpam = new string_id("jedi_spam", "staunch_poison_other");
|
|
prose_package proseTest = prose.getPackage(strSpam, objTarget);
|
|
sendSystemMessageProse(objPlayer, proseTest);
|
|
}
|
|
}
|
|
}
|
|
|
|
return;
|
|
}
|
|
|
|
|
|
dictionary modifyJediHealDataFromAlignment(obj_id objPlayer, dictionary dctJediInfo)
|
|
{
|
|
|
|
float fltAlignmentModifier = jedi.getJediAlignmentModifier(objPlayer, dctJediInfo);
|
|
// yuck casting/getting/putting function. I cast into a float to make sure i don't get zeroes too earlt.
|
|
|
|
int intMinMindHeal= dctJediInfo.getInt("intMinMindHeal");
|
|
float fltTest = (float)intMinMindHeal;
|
|
fltTest = fltTest * fltAlignmentModifier;
|
|
intMinMindHeal = (int)fltTest;
|
|
dctJediInfo.put("intMinMindHeal", intMinMindHeal);
|
|
|
|
|
|
|
|
int intMaxMindHeal= dctJediInfo.getInt("intMaxMindHeal");
|
|
fltTest = (float)intMaxMindHeal;
|
|
fltTest = fltTest * fltAlignmentModifier;
|
|
intMaxMindHeal = (int)fltTest;
|
|
dctJediInfo.put("intMaxMindHeal", intMaxMindHeal);
|
|
|
|
|
|
int intMinMindWoundHeal = dctJediInfo.getInt("intMinMindWoundHeal");
|
|
fltTest = (float)intMinMindWoundHeal;
|
|
fltTest = fltTest * fltAlignmentModifier;
|
|
intMinMindWoundHeal = (int)fltTest;
|
|
dctJediInfo.put("intMinMindWoundHeal", intMinMindWoundHeal);
|
|
|
|
int intMaxMindWoundHeal = dctJediInfo.getInt("intMaxMindWoundHeal");
|
|
fltTest = (float)intMaxMindWoundHeal;
|
|
fltTest = fltTest * fltAlignmentModifier;
|
|
intMaxMindWoundHeal = (int)fltTest;
|
|
dctJediInfo.put("intMaxMindWoundHeal", intMaxMindWoundHeal);
|
|
|
|
int intMinHealthHeal= dctJediInfo.getInt("intMinHealthHeal");
|
|
fltTest = (float)intMinHealthHeal;
|
|
fltTest = fltTest * fltAlignmentModifier;
|
|
intMinHealthHeal = (int)fltTest;
|
|
dctJediInfo.put("intMinHealthHeal", intMinHealthHeal);
|
|
|
|
int intMaxHealthHeal= dctJediInfo.getInt("intMaxHealthHeal");
|
|
fltTest = (float)intMaxHealthHeal;
|
|
fltTest = fltTest * fltAlignmentModifier;
|
|
intMaxHealthHeal = (int)fltTest;
|
|
dctJediInfo.put("intMaxHealthHeal", intMaxHealthHeal);
|
|
|
|
int intMinHealthWoundHeal = dctJediInfo.getInt("intMinHealthWoundHeal");
|
|
fltTest = (float)intMinHealthWoundHeal;
|
|
fltTest = fltTest * fltAlignmentModifier;
|
|
intMinHealthWoundHeal = (int)fltTest;
|
|
dctJediInfo.put("intMinHealthWoundHeal", intMinHealthWoundHeal);
|
|
|
|
int intMaxHealthWoundHeal = dctJediInfo.getInt("intMaxHealthWoundHeal");
|
|
fltTest = (float)intMaxHealthWoundHeal;
|
|
fltTest = fltTest * fltAlignmentModifier;
|
|
intMaxHealthWoundHeal = (int)fltTest;
|
|
dctJediInfo.put("intMaxHealthWoundHeal", intMaxHealthWoundHeal);
|
|
|
|
int intMinActionHeal = dctJediInfo.getInt("intMinActionHeal");
|
|
fltTest = (float)intMinActionHeal;
|
|
fltTest = fltTest * fltAlignmentModifier;
|
|
intMinActionHeal = (int)fltTest;
|
|
dctJediInfo.put("intMinActionHeal", intMinActionHeal);
|
|
|
|
int intMaxActionHeal = dctJediInfo.getInt("intMaxActionHeal");
|
|
fltTest = (float)intMaxActionHeal;
|
|
fltTest = fltTest * fltAlignmentModifier;
|
|
intMaxActionHeal = (int)fltTest;
|
|
dctJediInfo.put("intMaxActionHeal", intMaxActionHeal);
|
|
|
|
|
|
int intMinActionWoundHeal= dctJediInfo.getInt("intMinActionWoundHeal");
|
|
fltTest = (float)intMinActionWoundHeal;
|
|
fltTest = fltTest * fltAlignmentModifier;
|
|
intMinActionWoundHeal = (int)fltTest;
|
|
dctJediInfo.put("intMinActionWoundHeal", intMinActionWoundHeal);
|
|
|
|
|
|
int intMaxActionWoundHeal= dctJediInfo.getInt("intMaxActionWoundHeal");
|
|
fltTest = (float)intMaxActionWoundHeal;
|
|
fltTest = fltTest * fltAlignmentModifier;
|
|
intMaxActionWoundHeal = (int)fltTest;
|
|
dctJediInfo.put("intMaxActionWoundHeal", intMaxActionWoundHeal);
|
|
|
|
|
|
int intMinBattleFatigueHeal = dctJediInfo.getInt("intMinBattleFatigueHeal");
|
|
fltTest = (float)intMinBattleFatigueHeal;
|
|
fltTest = fltTest * fltAlignmentModifier;
|
|
intMinBattleFatigueHeal = (int)fltTest;
|
|
dctJediInfo.put("intMinBattleFatigueHeal", intMinBattleFatigueHeal);
|
|
|
|
|
|
int intMaxBattleFatigueHeal = dctJediInfo.getInt("intMaxBattleFatigueHeal");
|
|
fltTest = (float)intMaxBattleFatigueHeal;
|
|
fltTest = fltTest * fltAlignmentModifier;
|
|
intMaxBattleFatigueHeal = (int)fltTest;
|
|
dctJediInfo.put("intMaxBattleFatigueHeal", intMaxBattleFatigueHeal);
|
|
|
|
|
|
return dctJediInfo;
|
|
}
|
|
|
|
|
|
|
|
int performJediHealCommand(obj_id player, obj_id target, dictionary actionData)
|
|
{
|
|
const int BLEED_HEAL_STRENGTH = 250;
|
|
const int POISON_HEAL_STRENGTH = 250;
|
|
const int DISEASE_HEAL_STRENGTH = 100;
|
|
const int FIRE_HEAL_STRENGTH = 500;
|
|
|
|
boolean boolHealedStats = false;
|
|
boolean boolHealedWounds = false;
|
|
boolean boolHealedBattleFatigue = false;
|
|
boolean boolHealedState = false;
|
|
boolean boolHealedBleeding = false;
|
|
boolean boolHealedDots = false;
|
|
|
|
int maxHealthHeal = actionData.getInt("intMaxHealthHeal");
|
|
int maxHealthWoundHeal = actionData.getInt("intMaxHealthWoundHeal");
|
|
int maxBattleFatigueHeal = actionData.getInt("intMaxBattleFatigueHeal");
|
|
|
|
int healStates = actionData.getInt("intHealStates");
|
|
int healBleeding = actionData.getInt("intHealBleeding");
|
|
int healPoison = actionData.getInt("intHealPoison");
|
|
int healDisease = actionData.getInt("intHealDisease");
|
|
int healFire = actionData.getInt("intHealFire");
|
|
|
|
float extraForceCost = jedi.getModifiedExtraForceCost(player, actionData.getFloat("extraForceCost"), actionData.getString("intActionId"));
|
|
int totalForceCost = jedi.getModifiedForceCost(player, actionData.getInt("intJediPowerCost"), actionData.getString("intActionId"));
|
|
int jediForcePower = getForcePower(player);
|
|
|
|
// we do health then battle fatigue
|
|
// if any values are -1, we do a full heal
|
|
|
|
// HEALTH
|
|
if (totalForceCost < jediForcePower && maxHealthHeal != 0 )
|
|
{
|
|
int curHealth = getHealth(target);
|
|
int maxHealth = getWoundedMaxAttrib(target, HEALTH);
|
|
|
|
float healForceCost = 0;
|
|
int healthToHeal = 0;
|
|
|
|
// See if we can heal the max amount
|
|
if (maxHealthHeal != 0 && curHealth < maxHealth)
|
|
{
|
|
healthToHeal = maxHealth - curHealth;
|
|
if (maxHealthHeal > 0 && healthToHeal > maxHealthHeal) healthToHeal = maxHealthHeal;
|
|
healForceCost += healthToHeal * extraForceCost;
|
|
}
|
|
|
|
// Check if we have enough Force. If not do partial heal.
|
|
if ((totalForceCost + (int)healForceCost) > jediForcePower)
|
|
{
|
|
healForceCost = (jediForcePower - totalForceCost);
|
|
|
|
while (healthToHeal * extraForceCost > healForceCost)
|
|
{
|
|
healthToHeal -= 1; if (healthToHeal < 0) healthToHeal = 0;
|
|
}
|
|
}
|
|
|
|
// Apply heal
|
|
if (healthToHeal > 0)
|
|
{
|
|
boolHealedStats = true;
|
|
totalForceCost += (int)healForceCost;
|
|
|
|
if (healthToHeal > 0)
|
|
{
|
|
healing.healDamage(player, target, HEALTH, healthToHeal);
|
|
doJediHealingSpam(HEALTH, DAMAGE, healthToHeal, player, target);
|
|
}
|
|
}
|
|
}
|
|
|
|
// BATTLE FATIGUE
|
|
if (totalForceCost < jediForcePower && maxBattleFatigueHeal != 0)
|
|
{
|
|
int fatigueToHeal = 0;
|
|
float fatigueHealForceCost = 0;
|
|
|
|
if (maxBattleFatigueHeal != 0)
|
|
{
|
|
fatigueToHeal = getShockWound(target);
|
|
if (maxBattleFatigueHeal > 0 && fatigueToHeal > maxBattleFatigueHeal) fatigueToHeal = maxBattleFatigueHeal;
|
|
fatigueHealForceCost += fatigueToHeal * extraForceCost;
|
|
}
|
|
|
|
// Check if we have enough Force. If not do partial heal.
|
|
if ((totalForceCost + (int)fatigueHealForceCost) > jediForcePower)
|
|
{
|
|
fatigueHealForceCost = jediForcePower - totalForceCost;
|
|
|
|
while (fatigueToHeal * extraForceCost > fatigueHealForceCost)
|
|
{
|
|
fatigueToHeal -= 1;
|
|
|
|
if (fatigueToHeal < 0) fatigueToHeal = 0;
|
|
}
|
|
}
|
|
|
|
// Apply heal
|
|
if (fatigueToHeal > 0)
|
|
{
|
|
boolHealedBattleFatigue = true;
|
|
totalForceCost += (int)fatigueHealForceCost;
|
|
|
|
healShockWound(target, fatigueToHeal);
|
|
doJediHealingSpam(BATTLE_FATIGUE, WOUNDS, fatigueToHeal, player, target);
|
|
}
|
|
}
|
|
|
|
// States
|
|
if (totalForceCost < jediForcePower && healStates != 0)
|
|
{
|
|
int statesToHeal = 0;
|
|
float stateHealForceCost = 0;
|
|
|
|
for (int i = 0; i < STATE_NUMBER_OF_STATES; i++)
|
|
{
|
|
if (hasObjVar(target, "combat.intEffects."+i))
|
|
{
|
|
statesToHeal++;
|
|
stateHealForceCost += healStates;
|
|
}
|
|
}
|
|
|
|
// Check if we have enough Force. If not do partial heal.
|
|
if ((totalForceCost + (int)stateHealForceCost) > jediForcePower)
|
|
{
|
|
stateHealForceCost = jediForcePower - totalForceCost;
|
|
|
|
while (stateHealForceCost > jediForcePower - totalForceCost)
|
|
{
|
|
statesToHeal -= 1; if (statesToHeal < 0) statesToHeal = 0;
|
|
stateHealForceCost += healStates; if (stateHealForceCost < 0) stateHealForceCost = 0;
|
|
}
|
|
}
|
|
|
|
// Apply heal
|
|
if (statesToHeal > 0)
|
|
{
|
|
}
|
|
}
|
|
|
|
// Bleeding
|
|
if (totalForceCost < jediForcePower && healBleeding != 0)
|
|
{
|
|
if ((totalForceCost + healBleeding) < jediForcePower)
|
|
{
|
|
int healResult = dot.reduceDotTypeStrength(target, dot.DOT_BLEEDING, BLEED_HEAL_STRENGTH);
|
|
if (healResult >= 0)
|
|
{
|
|
// Apply heal
|
|
boolHealedBleeding = true;
|
|
totalForceCost += healBleeding;
|
|
doJediHealingSpam(BLEEDING, BLEEDING, healResult, player, target);
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
// Poison
|
|
if (totalForceCost < jediForcePower && healPoison != 0)
|
|
{
|
|
if ((totalForceCost + healPoison) < jediForcePower)
|
|
{
|
|
|
|
int healResult = dot.reduceDotTypeStrength(target, dot.DOT_POISON, POISON_HEAL_STRENGTH);
|
|
if (healResult >= 0)
|
|
{
|
|
// Apply heal
|
|
boolHealedDots = true;
|
|
totalForceCost += healPoison;
|
|
doJediHealingSpam(POISON, POISON, healResult, player, target);
|
|
}
|
|
}
|
|
}
|
|
|
|
// Disease
|
|
if (totalForceCost < jediForcePower && healDisease != 0)
|
|
{
|
|
if ((totalForceCost + healDisease) < jediForcePower)
|
|
{
|
|
int healResult = dot.reduceDotTypeStrength(target, dot.DOT_DISEASE, DISEASE_HEAL_STRENGTH);
|
|
if (healResult >= 0)
|
|
{
|
|
// Apply heal
|
|
boolHealedDots = true;
|
|
totalForceCost += healDisease;
|
|
doJediHealingSpam(DISEASE, DISEASE, healResult, player, target);
|
|
}
|
|
}
|
|
}
|
|
|
|
// Fire
|
|
if (totalForceCost < jediForcePower && healFire != 0)
|
|
{
|
|
if ((totalForceCost + healFire) < jediForcePower)
|
|
{
|
|
int healResult = dot.reduceDotTypeStrength(target, dot.DOT_FIRE, FIRE_HEAL_STRENGTH);
|
|
if (healResult >= 0)
|
|
{
|
|
// Apply heal
|
|
boolHealedDots = true;
|
|
totalForceCost += healFire;
|
|
//doJediHealingSpam(FIRE, FIRE, healResult, player, target);
|
|
}
|
|
}
|
|
}
|
|
|
|
if (boolHealedStats || boolHealedWounds || boolHealedBattleFatigue ||
|
|
boolHealedState || boolHealedBleeding || boolHealedDots)
|
|
{
|
|
jedi.playJediActionEffect(player, target, actionData);
|
|
}
|
|
else
|
|
{
|
|
// no heal
|
|
totalForceCost = 0;
|
|
if(target!=player)
|
|
{
|
|
string_id strSpam = new string_id("jedi_spam", "no_damage_heal_other");
|
|
sendSystemMessage(player, strSpam);
|
|
}
|
|
else
|
|
{
|
|
string_id strSpam = new string_id("jedi_spam", "no_damage_heal_self");
|
|
sendSystemMessage(player, strSpam);
|
|
}
|
|
}
|
|
|
|
return totalForceCost;
|
|
}
|
|
|
|
boolean doJediHealCommand(obj_id self, obj_id target, string strCommand)
|
|
{
|
|
int intCommand = getStringCrc(strCommand); // Must get crc before changing internal name.
|
|
strCommand = combat.getBestAction(self, strCommand);
|
|
|
|
// Make sure we are not wearing armor
|
|
int armorCount = utils.getIntScriptVar(self, armor.SCRIPTVAR_ARMOR_COUNT);
|
|
if (armorCount > 0)
|
|
{
|
|
sendSystemMessage(self, new string_id("jedi_spam", "not_with_armor"));
|
|
return false;
|
|
}
|
|
|
|
//make sure we are not mezzed
|
|
if(buff.isParalyzed(self))
|
|
{
|
|
return false;
|
|
}
|
|
|
|
dictionary dctJediInfo = dataTableGetRow(jedi.JEDI_ACTIONS_FILE, strCommand);
|
|
LOG("jedi", "getting row "+strCommand+" from "+jedi.JEDI_ACTIONS_FILE);
|
|
|
|
if(dctJediInfo==null)
|
|
{
|
|
LOG("DESIGNER_FATAL","Action "+strCommand+" has no entry in the jedi actions datatable");
|
|
return false;
|
|
}
|
|
|
|
target = jedi.getCorrectFriendlyTarget(self, target, dctJediInfo);
|
|
if(!isIdValid(target))
|
|
{
|
|
LOG("jedi", "No valid target");
|
|
return false;
|
|
}
|
|
|
|
if (ai_lib.isDroid(target) || ai_lib.isAndroid(target) || ai_lib.isVehicle(target) || vehicle.isVehicle(target))
|
|
{
|
|
sendSystemMessage(self, new string_id("jedi_spam", "no_help_target"));
|
|
return false;
|
|
}
|
|
|
|
// int intPosture = getPosture(self);
|
|
// if(intPosture!=POSTURE_UPRIGHT)
|
|
// {
|
|
// LOG("jedi", "No valid Posture");
|
|
// queueCommand(self, ##"stand", null, "", COMMAND_PRIORITY_DEFAULT);
|
|
// queueCommand(self, intCommand, target, "", COMMAND_PRIORITY_FRONT);
|
|
// }
|
|
|
|
if(!jedi.doNonCombatActionPrecheck(self, target, dctJediInfo))
|
|
{
|
|
LOG("jedi", "non combat precheck failed");
|
|
return false;
|
|
}
|
|
LOG("jedi", "self is "+self+" target is "+target);
|
|
|
|
// Load the weapon data
|
|
weapon_data weaponData = new weapon_data();
|
|
weaponData = getWeaponData(getCurrentWeapon(self));
|
|
|
|
//check action and mind costs
|
|
int[] actionCost = combat.getActionCost(self, weaponData, dctJediInfo);
|
|
if(!combat.canDrainCombatActionAttributes(self, actionCost))
|
|
return false;
|
|
int health_before = getAttrib(target,HEALTH);
|
|
int intForcePowerCost = performJediHealCommand(self, target, dctJediInfo);
|
|
|
|
//make sure you can pay force
|
|
if(!jedi.drainForcePower(self, intForcePowerCost))
|
|
{
|
|
// system message
|
|
LOG("jedi", "no force power");
|
|
string_id strSpam = new string_id("jedi_spam", "no_force_power");
|
|
sendSystemMessage(self, strSpam);
|
|
return false;
|
|
}
|
|
//heal stuff
|
|
if(intForcePowerCost > 0)
|
|
{
|
|
combat.drainCombatActionAttributes(self, actionCost);
|
|
int intVisibilityValue = dctJediInfo.getInt("intVisibilityValue");
|
|
int intVisibilityRange = dctJediInfo.getInt("intVisibilityRange");
|
|
jedi.jediActionPerformed(self, intVisibilityValue, intVisibilityRange);
|
|
LOG("jedi", "Performed heal command");
|
|
// punish with TEF system
|
|
pvpHelpPerformed(self, target);
|
|
jedi.doJediNonCombatAnimation(self, target, dctJediInfo);
|
|
|
|
// Add Hate
|
|
int health_after = getAttrib(target,HEALTH);
|
|
int health_delta = (int)((health_after - health_before) * 0.5f);
|
|
healing._addMedicalHate(self, target, health_delta);
|
|
|
|
// Grant Jedi XP
|
|
int xpOverride = dctJediInfo.getInt("xpOverride");
|
|
if (xpOverride < 0)
|
|
xpOverride = intForcePowerCost;
|
|
jedi.grantJediXP(self, xpOverride);
|
|
stealth.testInvisNonCombatAction(self, target); // cant heal while cloaked
|
|
}
|
|
else
|
|
{
|
|
//pass this out to clear the action timers
|
|
return false;
|
|
}
|
|
|
|
return true;
|
|
}
|
|
|
|
void findNewSkillTrainer(obj_id self)
|
|
{
|
|
const string[] TRAINER_TYPES = { "trainer_brawler", "trainer_artisan", "trainer_scout", "trainer_marksman", "trainer_entertainer", "trainer_medic"};
|
|
|
|
location locTest = getLocation(self);
|
|
if(locTest.area.equals("tutorial"))
|
|
{
|
|
removeObjVar(self, "jedi.locTrainerLocation");
|
|
return;
|
|
}
|
|
string strPrimaryCategory = "trainer";
|
|
string strSecondaryCategory = TRAINER_TYPES[rand(0, TRAINER_TYPES.length-1)];
|
|
map_location[] rawMapLocations = getPlanetaryMapLocations(strPrimaryCategory, strSecondaryCategory);
|
|
|
|
// Filter out locations in player cities.
|
|
resizeable map_location[] mapLocations = new map_location[0];
|
|
location testloc = new location();
|
|
for ( int i=0; i<rawMapLocations.length; i++ )
|
|
{
|
|
testloc.x = rawMapLocations[i].getX();
|
|
testloc.z = rawMapLocations[i].getY();
|
|
testloc.area = getLocation(self).area;
|
|
if ( getCityAtLocation( testloc, 0 ) > 0 )
|
|
continue;
|
|
mapLocations = utils.addElement( mapLocations, rawMapLocations[i] );
|
|
}
|
|
|
|
if((mapLocations==null)||(mapLocations.length==0))
|
|
{
|
|
removeObjVar(self, "jedi.locTrainerLocation");
|
|
return;
|
|
}
|
|
|
|
locTest.y = 0;
|
|
resizeable location[] locNewLocations = new location[0];
|
|
for(int intI = 0; intI<mapLocations.length; intI++)
|
|
{
|
|
location locNewLocation = new location();
|
|
locNewLocation.area = locTest.area;
|
|
locNewLocation.x = mapLocations[intI].getX();
|
|
locNewLocation.z = mapLocations[intI].getY();
|
|
float fltDistance = getDistance(locTest, locNewLocation);
|
|
if(fltDistance>128)
|
|
{
|
|
locNewLocations = utils.addElement(locNewLocations, locNewLocation);
|
|
}
|
|
|
|
}
|
|
if(locNewLocations.length<1)
|
|
{
|
|
removeObjVar(self, "jedi.locTrainerLocation");
|
|
return;
|
|
|
|
}
|
|
|
|
location locFinalLocation = locNewLocations[rand(0, locNewLocations.length-1)];
|
|
setObjVar(self, "jedi.locTrainerLocation", locFinalLocation);
|
|
string_id strSpam = new string_id("jedi_spam", "trainer_updated");
|
|
sendSystemMessage(self, strSpam);
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
|