mirror of
https://github.com/SWG-Source/dsrc.git
synced 2026-07-31 00:15:54 -04:00
127 lines
3.1 KiB
Plaintext
127 lines
3.1 KiB
Plaintext
/**
|
|
* Copyright (c)2000-2002 Sony Online Entertainment Inc.
|
|
* All Rights Reserved
|
|
*
|
|
* Title: meditate.script
|
|
* Description: meditate script for players using the meditate command
|
|
* @author $Author:$
|
|
* @version $Revision:$
|
|
*/
|
|
|
|
/***** INCLUDES ********************************************************/
|
|
|
|
include library.buff;
|
|
include library.combat;
|
|
include library.utils;
|
|
include library.prose;
|
|
include library.meditation;
|
|
include library.player_structure;
|
|
|
|
inherits systems.combat.combat_base;
|
|
|
|
/***** CONSTANTS *******************************************************/
|
|
|
|
|
|
/***** TRIGGERS ********************************************************/
|
|
|
|
|
|
/***** HANDLERS ********************************************************/
|
|
|
|
|
|
/***** FORCE OF WILL ********************************************************/
|
|
commandHandler cmdForceOfWill()
|
|
{
|
|
int modval = meditation.getMeditationSkillMod(self);
|
|
if ( modval < 1 )
|
|
return SCRIPT_CONTINUE;
|
|
|
|
if ( getPosture(self) != POSTURE_INCAPACITATED )
|
|
{
|
|
sendSystemMessage(self, meditation.SID_FORCEOFWILL_FAIL);
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
int stamp = getIntObjVar(self, meditation.VAR_FORCE_OF_WILL_ACTIVE);
|
|
if ( stamp < 0 )
|
|
{
|
|
sendSystemMessage(self, meditation.SID_FORCEOFWILL_LOST);
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
int now = getGameTime();
|
|
int delta = now - (stamp+3600);
|
|
if ( delta < 0 )
|
|
{
|
|
string time_string = player_structure.assembleTimeRemaining(player_structure.convertSecondsTime(-delta));
|
|
prose_package ppUnavailable = prose.getPackage(meditation.SID_FORCEOFWILL_UNAVAILABLE, time_string);
|
|
sendSystemMessageProse(self, ppUnavailable);
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
int roll = rand(0, 100);
|
|
if ( roll < 5 || modval < roll )
|
|
{
|
|
sendSystemMessage(self, meditation.SID_FORCEOFWILL_UNSUCCESSFUL);
|
|
setObjVar(self, meditation.VAR_FORCE_OF_WILL_ACTIVE, -1);
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
else
|
|
{
|
|
meditation.forceOfWill(self, modval-roll);
|
|
setObjVar(self, meditation.VAR_FORCE_OF_WILL_ACTIVE, now);
|
|
}
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
commandHandler cmdForceOfWillFail()
|
|
{
|
|
sendSystemMessage(self, meditation.SID_FORCEOFWILL_FAIL);
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
/***** POWER BOOST ********************************************************/
|
|
commandHandler cmdPowerBoost()
|
|
{
|
|
if(!isIdValid(self))
|
|
{
|
|
return SCRIPT_OVERRIDE;
|
|
}
|
|
|
|
int modval = meditation.getMeditationSkillMod(self);
|
|
if((modval < 1))
|
|
{
|
|
return SCRIPT_OVERRIDE;
|
|
}
|
|
|
|
if(!meditation.isMeditating(self))
|
|
{
|
|
combat.sendCombatSpamMessage(self, meditation.SID_POWERBOOST_FAIL);
|
|
return SCRIPT_OVERRIDE;
|
|
}
|
|
|
|
if(buff.hasBuff(self, "powerBuff"))
|
|
{
|
|
combat.sendCombatSpamMessage(self, meditation.SID_POWERBOOST_ACTIVE);
|
|
return SCRIPT_OVERRIDE;
|
|
}
|
|
|
|
float duration = 300.0f + ((float)(modval) * 3.0f);
|
|
|
|
if(!combatStandardAction("powerBoost", self, self, null, "", ""))
|
|
{
|
|
return SCRIPT_OVERRIDE;
|
|
}
|
|
|
|
buff.applyBuff(self, "powerBoost", duration);
|
|
|
|
combat.sendCombatSpamMessage(self, meditation.SID_POWERBOOST_BEGIN);
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
commandHandler cmdPowerBoostFail()
|
|
{
|
|
combat.sendCombatSpamMessage(self, meditation.SID_POWERBOOST_FAIL);
|
|
return SCRIPT_CONTINUE;
|
|
}
|