// TMW2 scripts.
// Authors:
// Jesusalva
// TMW Org.
// Description:
// HUB functions (Magic)
// HUB_SkillInvoke ( )
function script HUB_SkillInvoke {
// Something is... wrong
if (!@skillId) {
Exception("ILLEGAL SKILL PASSED TO HUB. It has been compromised, Jim.", RB_DEBUGMES|RB_IRCBROADCAST);
debugmes "Legal Caster: %s", strcharinfo(0);
debugmes "Effective Caster: %d", @skillCaster;
return;
}
/* *********************************************************************** */
// TODO: Detect what was script-cast and what was player-case. Then, readd RB_IRCBROADCAST
// If you can't do this: You can't do this
if (getskilllv(@skillId) < @skillLv && @skillId != BS_GREED)
Exception("System ERROR, HSI."+@skillId+" INVALID CAST (got "+@skillLv+" expected "+getskilllv(@skillId)+", sub-LC."+(getcharid(3)-2000000)+")", RB_DEBUGMES|RB_ISFATAL);
// You are AFK for over 3 minutes, that's crazy, disregard
if (checkidle() > 180)
return;
// Record to database
skillInvoke[@skillId] = skillInvoke[@skillId] + 1;
// Script-based skills
/* *********************************************************************** */
switch (@skillId) {
case TMW2_FAKESKILL:
charcommand("@refresh"); // Possibly broken on too up-to-date Herc
break;
// Level 0
case SKILL_CONFRINGO:
SK_Confringo(); break;
case SKILL_REAPERCRY:
Reapercry(); break;
// Level 1
case SKILL_ABIZIT:
SK_Abizit(); break;
case SKILL_MONSTERINFO:
SK_Miteyo(); break;
case EVOL_AREA_PROVOKE:
SK_Itenplz(); break;
case SKILL_FLAR:
SK_Flar(); break;
case SKILL_MODRIPHOO:
case SKILL_MODRISUMP:
case SKILL_MODRIYIKAM:
case SKILL_MODRILAX:
SK_GrowPlants(); break; // FIXME: Unreleased/cannot be learned
case SKILL_LUM:
SK_Lum(); break;
case SKILL_CHIZA:
SK_Chiza(); break;
case SKILL_PARUM:
case SKILL_GOLE:
SK_Transmute(); break;
// Level 2
case SKILL_INMA:
SK_Inma(); break;
case SKILL_JOYPLIM:
SK_Joyplim(); break;
case SKILL_CHIPCHIP:
SK_Shear(); break;
case SKILL_KALAKARENK:
case SKILL_KALBOO:
case SKILL_KALGINA:
case SKILL_KALRENK:
SK_SummonLv2(); break;
case SKILL_HALHISS:
case SKILL_HELORP:
SK_SummonLv2(); break;
case SKILL_KAFLOSH:
SK_Kaflosh(); break;
case SKILL_BETSANC:
SK_Betsanc(); break;
case SKILL_ASORM:
SK_Asorm(); break;
case SKILL_INGRAV:
SK_Ingrav(); break;
case SKILL_UPMARMU:
SK_Uparmu(); break;
case SKILL_FRILLYAR:
SK_Frillyar(); break;
case SKILL_PHLEX:
SK_Phlex(); break;
case SKILL_KULARZUFRILL:
case SKILL_ZUKMINBIRF:
case SKILL_PATMUPLOO:
case SKILL_PATVILOREE:
case SKILL_PATLOREE:
case SKILL_MANPAHIL:
SK_Transmute(); break;
// Level 3
// Level 4
// Level 5
////////////////////////////////
/* XXX: Fire Class
// (May burn targets for damage over time)
case TMW2_ARMAGEDDON:
.@PW=140+(10*@skillLv);
.@RG=5+(@skillLv/5);
// 18% chance, 3s, 3x3 radius
areaharm(@skillTarget, .@RG, AdjustSpellpower(.@PW), HARM_MAGI, Ele_Fire);
areasc(.@RG, 6000, SC_BLOODING, BL_MOB|BL_PC|BL_HOM|BL_MER, 1, "filter_hostile", @skillTarget, 1800);
GetManaExp(TMW2_FIREBALL, 3);
break;
////////////////////////////////
// XXX: Earth Class
case TMW2_GAIABREAK:
.@PWA=170+(30*@skillLv);
.@PWB=110+(10*@skillLv);
.@dmg=AdjustSpellpower(.@PWA);
.@dsub=AdjustSpellpower(.@PWB);
harm(@skillTarget, .@dmg, HARM_MAGI, Ele_Earth);
rectharm(@skillTarget, 2, 5, .@dsub, HARM_MAGI, Ele_Earth);
areasc(2, 5000, SC_INCDEFRATE, BL_PC, 10, "filter_friendly");
GetManaExp(TMW2_METEORSTRIKE, 3);
break;
////////////////////////////////
// XXX: Physical Class (Regular)
case TMW2_FALKONSTRIKE:
.@PW=100+(25*@skillLv);
.@ST=0+(10*@skillLv);
.@TM=100+(90*@skillLv);
harm(@skillTarget, AdjustAttackpower(.@PW), HARM_PHYS, Ele_Neutral);
sc_start SC_STUN, .@TM, 1, .@ST, SCFLAG_NONE, @skillTarget;
GetManaExp(@skillId, 1);
break;
case TMW2_GROUNDSTRIKE:
.@PW=50+(40*@skillLv);
.@dmg=AdjustAttackpower(.@PW);
.@RG=2+(@skillLv/5);
.@TM=100+(@skillLv*200);
.@ST=500+(100*@skillLv);
.@EF=any(SC_STUN, SC_BLIND, SC_BLOODING, SC_BLIND, SC_BLOODING);
areaharm(@skillTarget, .@RG, .@dmg, HARM_PHYS, Ele_Neutral);
areasc(.@RG, .@TM, .@EF, BL_MOB | BL_PC | BL_HOM | BL_MER, 1, "filter_hostile", @skillTarget, .@ST);
GetManaExp(@skillId, 1);
break;
case TMW2_SUPREMEATTACK:
.@PW=100+(50*@skillLv);
harm(@skillTarget, AdjustAttackpower(.@PW), HARM_PHYS, Ele_Neutral);
GetManaExp(@skillId, 1);
break;
////////////////////////////////
// Summons which never fail
case TMW2_ZARKOR:
SummonMagic(@skillId, CaveMaggot, 2, @skillLv);
GetManaExp(@skillId, 1);
break;
// Summons which may fail
case TMW2_KALWULF:
SK_summon(Wolvern, 4, any(3,4));
break;
// More complex summons
case TMW2_FROZENHEART:
.@mobId=Moggun;
if (rand2(6,12) < abizit()+1)
{
.@mobId=Yeti;
}
SK_summon(.@mobId, 4, any(3,4));
break;
case TMW2_STONEHEART:
.@mobId=Terranite;
if (rand2(9,12) < abizit()+1 &&
BaseLevel > 80)
{
.@mobId=TerraniteProtector;
}
SK_summon(.@mobId, 4, any(4,5));
break;
*/
// Experience only
default:
GetManaExp(@skillId, 1);
break;
}
// Debug
if ($@GM_OVERRIDE)
debugmes "Cast skill %d on level %d - Target %d",
@skillId, @skillLv, @skillTarget;
// Cleanup (double-safe)
@skillTarget = 0;
return;
}
// HUB_PCBonus ()
function script HUB_PCBonus {
if (getcharid(3) == 2283619) debugmes "Recalculate HoraK.";
/* Evol2TMWA Stat Hacks */
// Criticals
// Dex
if (getiteminfo(getequipid(EQI_HAND_R), ITEMINFO_SUBTYPE) != W_BOW)
{
bonus bCritical, (readparam(bDex)+2)*3/20;
}
// Luck
// gives atm more crit then on tmwa
/* Passive Skills */
if (FOCUSING & FSKILL_ASTRAL_SOUL) {
bonus bMatkRate, -readparam(bMatkRate)+(getskilllv(SKILL_ASTRAL_SOUL)*(readparam(bVit)/9));
// mattack without equipment is already so high that any mattack from skill would make no sense so i completly remove mattack and calculate it again
// can't realy test it right now since +mattack and -mattack for many items dont work but for some of the common mage items it seems ok
}
if (FOCUSING & FSKILL_RAGING) {
if (getcharid(3) == 2283619) debugmes "Ragging is ON";
if (getiteminfo(getequipid(EQI_HAND_R), ITEMINFO_SUBTYPE) != W_BOW)
{
// atm trolls can use raging, I thought it's ok since they do damage over Str and have only a range of 3
if (getcharid(3) == 2283619) debugmes "Not a bow";
@item_crit = 0;
switch (getequipid(EQI_HEAD_TOP))
{
case AssassinMask:
case BullHelmet:
@item_crit = 15;
break;
case Monocle:
case Pipe:
@item_crit = 10;
break;
default:
@item_crit = 0;
break;
}
if (getcharid(3) == 2283619) debugmes "Crit is %d", @item_crit;
if (getequipid(EQI_HAND_R) == Beheader)
@item_crit -= 25;
bonus bCritical, (getskilllv(SKILL_RAGING))*((readparam(bDex)/40)+(readparam(bLuk)/30)+(@item_crit/10)+(readparam(bStr)/10)-2);
if (getcharid(3) == 2283619) debugmes "Result: %d", (getskilllv(SKILL_RAGING))*((readparam(bDex)/40)+(readparam(bLuk)/30)+(@item_crit/10)+(readparam(bStr)/10)-2);
if (getcharid(3) == 2283619) debugmes "Arg0: %d, Arg1: %d", getskilllv(SKILL_RAGING), ((readparam(bDex)/40)+(readparam(bLuk)/30)+(@item_crit/10)+(readparam(bStr)/10)-2);
// must balance that more to get less crit on lower dex
bonus bDef2, -(getskilllv(SKILL_RAGING)*((readparam(bStr)/20)-2));
}
}
if (FOCUSING & FSKILL_SPEED) {
bonus bSpeedAddRate, ((readparam(bAgi)*getskilllv(SKILL_SPEED))/60);
bonus bAspd, (((readparam(bAgi)/10)*getskilllv(SKILL_SPEED))/11); // gives exactly tmwa values if setzer on tmwa and dagger on evolved with 110 damage but its a bit higher for fists and high agi
}
if (FOCUSING & FSKILL_RESIST_POISON) {
.@l=5*getskilllv(SKILL_RESIST_POISON);
bonus2(bResEff, Eff_Silence, .@l);
bonus2(bResEff, Eff_Poison, .@l);
bonus2(bResEff, Eff_DPoison, .@l);
bonus2(bResEff, Eff_Curse, .@l);
bonus2(bResEff, Eff_Blind, .@l);
}
if (FOCUSING & FSKILL_BRAWLING) {
if (getequipid(EQI_HAND_R) < 1)
{
if (! (getiteminfo(getequipid(EQI_HAND_L), ITEMINFO_TYPE) == IT_ARMOR))
bonus bAtk, (readparam(bAgi)/10)*getskilllv(SKILL_BRAWLING); // on tmwa a shield removes attack bonus
//bonus bMaxHP, 15*getskilllv(SKILL_BRAWLING);
//bonus bFlee, (readparam(bAgi)/20)*getskilllv(SKILL_BRAWLING);
bonus bSpeedAddRate, (((readparam(bAgi)/2)*getskilllv(SKILL_BRAWLING))/80);
// bonus can be added here now instead of doing it on items itself
}
else if (getiteminfo(getequipid(EQI_HAND_R), ITEMINFO_SUBTYPE) == W_FIST)
{
if (! (getiteminfo(getequipid(EQI_HAND_L), ITEMINFO_TYPE) == IT_ARMOR))
bonus bAtk, (readparam(bAgi)/10)*getskilllv(SKILL_BRAWLING); // on tmwa a shield removes attack bonus
//bonus bMaxHP, 15*getskilllv(SKILL_BRAWLING);
//bonus bFlee, (readparam(bAgi)/20)*getskilllv(SKILL_BRAWLING);
bonus bSpeedAddRate, (((readparam(bAgi)/2)*getskilllv(SKILL_BRAWLING))/80);
// bonus can be added here now instead of doing it on items itself
}
}
if (FOCUSING & FSKILL_MALLARDS_EYE) {
if (getiteminfo(getequipid(EQI_HAND_R), ITEMINFO_SUBTYPE) == W_BOW || getiteminfo(getequipid(EQI_HAND_R), ITEMINFO_SUBTYPE) == W_HUUMA)
{
bonus bAtkRange, getskilllv(SKILL_MALLARDS_EYE)/3;
bonus bHit, (readparam(bDex)/20)*getskilllv(SKILL_MALLARDS_EYE);
bonus bAspd, (((readparam(bDex)/10)*getskilllv(SKILL_MALLARDS_EYE))/11)/4;
bonus bDoubleAddRate, (readparam(bDex)*getskilllv(SKILL_MALLARDS_EYE))/50; // max reachable is 18 Double Damage atm
}
}
if (getcharid(3) == 2283619) debugmes "Finished the bonus calc for HoraK";
/* Class A Equipment */
if (getequipid(EQI_HAND_R) > 1) {
if (isequipped(BullHelmet))
bonus bAtkRange, 1-getiteminfo(getequipid(EQI_HAND_R), ITEMINFO_RANGE);
}
return;
}