mirror of
https://bitbucket.org/seefoe/dsrc.git
synced 2026-07-31 01:15:55 -04:00
115 lines
2.6 KiB
Plaintext
115 lines
2.6 KiB
Plaintext
include library.buff;
|
|
include library.colors;
|
|
include library.combat;
|
|
include library.groundquests;
|
|
include library.group;
|
|
include library.healing;
|
|
include library.pet_lib;
|
|
include library.utils;
|
|
include library.vehicle;
|
|
include library.stealth;
|
|
|
|
const int CONE = 0;
|
|
const int SINGLE_TARGET= 1;
|
|
const int AREA = 2;
|
|
const int TARGET_AREA = 3; // area around target
|
|
|
|
const string NONCOMBAT_DATATABLE = "datatables/combat/non_combat_data.iff";
|
|
|
|
const int MAX_TARGET_ARRAY_SIZE = 10;
|
|
|
|
obj_id validateEnhancer(string parms)
|
|
{
|
|
if(parms == null || parms.length() < 1)
|
|
{
|
|
return null;
|
|
}
|
|
|
|
obj_id enhancer = utils.stringToObjId(parms);
|
|
if(!isIdValid(enhancer) || !exists(enhancer) || !hasScript(enhancer, "item.medicine.enhancer"))
|
|
{
|
|
return null;
|
|
}
|
|
|
|
return enhancer;
|
|
}
|
|
|
|
int[] getActionCost(obj_id self, dictionary actionData)
|
|
{
|
|
int[] cost = new int[2];
|
|
float healthCost;
|
|
float actionCost;
|
|
|
|
// Get base ability costs
|
|
healthCost = actionData.getFloat("healthCost") / 100f;
|
|
actionCost = actionData.getFloat("actionCost") / 100f;
|
|
combat.combatLog(self, null, "getActionCost", "Base Action cost = ["+healthCost+", "+actionCost+"]");
|
|
|
|
// Multiply by max HAM values
|
|
int maxHealth = getMaxAttrib(self, HEALTH);
|
|
int maxAction = getMaxAttrib(self, ACTION);
|
|
|
|
combat.combatLog(self, null, "getActionCost", "Max Attrib = ["+maxHealth+", "+maxAction+"]");
|
|
|
|
cost[0] = (int)(maxHealth * healthCost);
|
|
cost[1] = (int)(maxAction * actionCost);
|
|
combat.combatLog(self, null, "getActionCost", "Final Action cost = ["+cost[0]+", "+cost[1]+"]");
|
|
|
|
return cost;
|
|
}
|
|
|
|
string makeHealingPlaybackName(obj_id self, obj_id target, dictionary actionData)
|
|
{
|
|
string playbackName = actionData.getString("animDefault");
|
|
|
|
if (playbackName.endsWith("_*"))
|
|
{
|
|
playbackName = playbackName.substring(0, playbackName.length()-1);
|
|
|
|
if (self == target)
|
|
{
|
|
playbackName += "self";
|
|
}
|
|
else
|
|
{
|
|
playbackName += "other";
|
|
}
|
|
}
|
|
else if (playbackName.indexOf("&") != -1)
|
|
{
|
|
int index = playbackName.indexOf("&");
|
|
string remain = playbackName.substring(index+1, playbackName.length());
|
|
playbackName = playbackName.substring(0, index-1);
|
|
|
|
float dist = getDistance(self, target);
|
|
if (dist < 10)
|
|
{
|
|
playbackName += "_near"+remain;
|
|
}
|
|
else if (dist < 20)
|
|
{
|
|
playbackName += "_medium"+remain;
|
|
}
|
|
else
|
|
{
|
|
playbackName += "_far"+remain;
|
|
}
|
|
}
|
|
|
|
combat.combatLog(null, null, "makePlaybackName", "playback name = "+playbackName);
|
|
|
|
return playbackName;
|
|
}
|
|
|
|
string[] makeStringArray(int intLength)
|
|
{
|
|
int intI = 0;
|
|
string[] strArray = new string[intLength];
|
|
while(intI<intLength)
|
|
{
|
|
strArray[intI] = "";
|
|
intI = intI+1;
|
|
}
|
|
return strArray;
|
|
}
|