mirror of
https://github.com/SWG-Source/dsrc.git
synced 2026-07-13 22:01:04 -04:00
* Code compiles - execution NOT tested * updating gitignore * Removed intellij settings files * Removed more intellij files * Added exclusion for JDK classes. * Fixed purchasing script for vendors that have listed coin types. * Updated script to not kick off until the entire preload is complete. * adds static name entry for Solo movie poster and tcg9 vendor entry * clean up empty and orphaned object templates * adds placeholder black market (static) spawns * corrects entries for the video game table to correctly set it in tcg series 2 and remove series 1 console errors * Updated gitignore and removed intellij project files * Fixed appearance reference for thranta payroll and kashyyyk door, added skipLosCheck objvar due to cannit see issue. Requires updated src * Fixed appearance and template for terminal (#2) * Fixed appearance and template for terminal (#3) * Fixed appearance and template for terminal (#4) * Deleted another faulty/orphaned object template * Fixed gcw ranks option on frog. Only issue is that it doesn't award the officer commands or badges. * Fixed some unneeded java 11 changes
263 lines
8.7 KiB
Java
Executable File
263 lines
8.7 KiB
Java
Executable File
package script.systems.combat;
|
|
|
|
import script.attrib_mod;
|
|
import script.obj_id;
|
|
|
|
public class combat_test extends script.base_script
|
|
{
|
|
public combat_test()
|
|
{
|
|
}
|
|
public static final String VERSION = "v0.00.00";
|
|
public int OnInitialize(obj_id self) throws InterruptedException
|
|
{
|
|
detachScript(self, "systems.combat.combat_test");
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
public int OnAttach(obj_id self) throws InterruptedException
|
|
{
|
|
debugServerConsoleMsg(self, "combat_test: entered trigger OnAttach");
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
public int OnDetach(obj_id self) throws InterruptedException
|
|
{
|
|
debugServerConsoleMsg(self, "combat_test: entered trigger OnAttach");
|
|
debugServerConsoleMsg(self, "combat_test: Bye!");
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
public int OnRecapacitated(obj_id self) throws InterruptedException
|
|
{
|
|
debugServerConsoleMsg(self, "I'm no longer incapacitated!");
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
public int OnHearSpeech(obj_id self, obj_id speaker, String message) throws InterruptedException
|
|
{
|
|
if (message.equals("com recover"))
|
|
{
|
|
if (speaker != self)
|
|
{
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
if (isIncapacitated(self))
|
|
{
|
|
int attribute;
|
|
attribute = getAttrib(self, HEALTH);
|
|
if (attribute < 0)
|
|
{
|
|
setAttrib(self, HEALTH, -1);
|
|
}
|
|
attribute = getAttrib(self, ACTION);
|
|
if (attribute < 0)
|
|
{
|
|
setAttrib(self, ACTION, -1);
|
|
}
|
|
attribute = getAttrib(self, MIND);
|
|
if (attribute < 0)
|
|
{
|
|
setAttrib(self, MIND, -1);
|
|
}
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
else
|
|
{
|
|
debugSpeakMsg(self, "I'm not incapacitated!");
|
|
}
|
|
}
|
|
else if (message.equals("com report"))
|
|
{
|
|
String report = reportAttribs(self);
|
|
debugSpeakMsg(self, "My stats are currently: " + report + "");
|
|
}
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
public int OnIncapacitated(obj_id self, obj_id killer) throws InterruptedException
|
|
{
|
|
String killerName;
|
|
killerName = getName(killer);
|
|
debugServerConsoleMsg(self, "setting negative attribute(s) to -5");
|
|
int attribute;
|
|
attribute = getAttrib(self, HEALTH);
|
|
if (attribute < 0)
|
|
{
|
|
setAttrib(self, HEALTH, -5);
|
|
}
|
|
attribute = getAttrib(self, ACTION);
|
|
if (attribute < 0)
|
|
{
|
|
setAttrib(self, ACTION, -5);
|
|
}
|
|
attribute = getAttrib(self, MIND);
|
|
if (attribute < 0)
|
|
{
|
|
setAttrib(self, MIND, -5);
|
|
}
|
|
String report = reportAttribs(self);
|
|
debugServerConsoleMsg(self, "My stats are currently: " + report + "");
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
public int OnWeaponCombatAction(obj_id self, obj_id attacker, obj_id defender) throws InterruptedException
|
|
{
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
public int OnDefenderCombatAction(obj_id self, obj_id attacker, obj_id weapon, int where) throws InterruptedException
|
|
{
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
public String returnDamType(int attribute) throws InterruptedException
|
|
{
|
|
String damType;
|
|
switch (attribute)
|
|
{
|
|
case HEALTH:
|
|
damType = "Health";
|
|
break;
|
|
case CONSTITUTION:
|
|
damType = "Constitution";
|
|
break;
|
|
case ACTION:
|
|
damType = "Action";
|
|
break;
|
|
case STAMINA:
|
|
damType = "Stamina";
|
|
break;
|
|
case MIND:
|
|
damType = "Mind";
|
|
break;
|
|
case WILLPOWER:
|
|
damType = "Willpower";
|
|
break;
|
|
default:
|
|
damType = "None";
|
|
break;
|
|
}
|
|
return (damType);
|
|
}
|
|
public String victimReportDamage(obj_id self, obj_id attacker, attrib_mod[] attackEffects) throws InterruptedException
|
|
{
|
|
int effectsLength = 0;
|
|
if (attackEffects != null)
|
|
{
|
|
effectsLength = attackEffects.length;
|
|
}
|
|
else
|
|
{
|
|
debugServerConsoleMsg(self, "attackEffects was NULL! Exiting...");
|
|
return null;
|
|
}
|
|
if (effectsLength == 0)
|
|
{
|
|
debugServerConsoleMsg(self, "No damage done. That's odd...");
|
|
return null;
|
|
}
|
|
debugServerConsoleMsg(self, "effectsLength is " + effectsLength);
|
|
int damPoints = 0;
|
|
int damIntType = 0;
|
|
String damType = "unknown";
|
|
String damageReport = "Damage Report: ";
|
|
for (attrib_mod attackEffect : attackEffects) {
|
|
if (attackEffect == null) {
|
|
break;
|
|
}
|
|
int attribute = attackEffect.getAttribute();
|
|
damPoints = attackEffect.getValue();
|
|
float duration = attackEffect.getDuration();
|
|
float attack = attackEffect.getAttack();
|
|
float decay = attackEffect.getDecay();
|
|
if (damPoints != 0) {
|
|
int curAttributeLevel;
|
|
int maxAttributeLevel;
|
|
int newAttributeLevel;
|
|
damType = returnDamType(attribute);
|
|
curAttributeLevel = getAttrib(self, attribute);
|
|
maxAttributeLevel = getMaxAttrib(self, attribute);
|
|
newAttributeLevel = (curAttributeLevel - damPoints);
|
|
if (!damType.equals("none")) {
|
|
String damageElement = "" + damPoints + " of " + damType + " (" + newAttributeLevel + "/" + maxAttributeLevel + "), ";
|
|
damageReport = join(damageReport, damageElement);
|
|
}
|
|
}
|
|
}
|
|
return damageReport;
|
|
}
|
|
public String getHitLocationName(obj_id self, int hitLocation) throws InterruptedException
|
|
{
|
|
String hitLocationName;
|
|
switch (hitLocation)
|
|
{
|
|
case 0:
|
|
hitLocationName = "body";
|
|
break;
|
|
case 1:
|
|
hitLocationName = "head";
|
|
break;
|
|
case 2:
|
|
hitLocationName = "right arm";
|
|
break;
|
|
case 3:
|
|
hitLocationName = "left arm";
|
|
break;
|
|
case 4:
|
|
hitLocationName = "right leg";
|
|
break;
|
|
case 5:
|
|
hitLocationName = "left leg";
|
|
break;
|
|
default:
|
|
hitLocationName = "none";
|
|
debugServerConsoleMsg(self, "combat_test couldn't determine the hit location!");
|
|
break;
|
|
}
|
|
return (hitLocationName);
|
|
}
|
|
public int doStateCheck(obj_id self, int hitLocation, obj_id weapon, attrib_mod[] attackEffects) throws InterruptedException
|
|
{
|
|
String hitLocationName;
|
|
int hit;
|
|
switch (hitLocation)
|
|
{
|
|
case 0:
|
|
hitLocationName = "body";
|
|
break;
|
|
case 1:
|
|
hitLocationName = "head";
|
|
break;
|
|
case 2:
|
|
hitLocationName = "right arm";
|
|
break;
|
|
case 3:
|
|
hitLocationName = "left arm";
|
|
break;
|
|
case 4:
|
|
hitLocationName = "right leg";
|
|
break;
|
|
case 5:
|
|
hitLocationName = "left leg";
|
|
break;
|
|
default:
|
|
hitLocationName = "none";
|
|
debugServerConsoleMsg(self, "combat_test couldn't determine the hit location!");
|
|
break;
|
|
}
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
public String reportAttribs(obj_id target) throws InterruptedException
|
|
{
|
|
String reportsum = "";
|
|
String element = "";
|
|
String attribname = "";
|
|
int curAttributeLevel = getAttrib(target, HEALTH);
|
|
attribname = returnDamType(HEALTH);
|
|
element = ("" + attribname + " = " + curAttributeLevel + ",");
|
|
reportsum = join(reportsum, element);
|
|
curAttributeLevel = getAttrib(target, ACTION);
|
|
attribname = returnDamType(ACTION);
|
|
element = ("" + attribname + " = " + curAttributeLevel + ",");
|
|
reportsum = join(reportsum, element);
|
|
curAttributeLevel = getAttrib(target, MIND);
|
|
attribname = returnDamType(MIND);
|
|
element = ("" + attribname + " = " + curAttributeLevel + ",");
|
|
reportsum = join(reportsum, element);
|
|
return reportsum;
|
|
}
|
|
}
|