-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #292 from DragonSlayer62/leech-aos-propties
Added AOS Leech Properties
- Loading branch information
Showing
14 changed files
with
240 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
function onEquip( pEquipper, iEquipped ) | ||
{ | ||
pEquipper.AddScriptTrigger( 7003 ); | ||
} | ||
|
||
// Remove script trigger on unequip | ||
function onUnequip( pUnequipper, iUnequipped ) | ||
{ | ||
pUnequipper.RemoveScriptTrigger( 7003 ); | ||
} | ||
|
||
function onDamageDeal( attacker, damaged, damageValue, damageType ) | ||
{ | ||
// Fetch weapon in main hand or secondary hand | ||
var iWeapon = attacker.FindItemLayer( 0x01 ); | ||
if( !ValidateObject( iWeapon )) | ||
{ | ||
iWeapon = attacker.FindItemLayer( 0x02 ); | ||
} | ||
|
||
if( ValidateObject( iWeapon )) | ||
{ // Apply leech effects based on weapon properties | ||
ApplyLeech( attacker, damaged, damageValue, iWeapon, 'healthLeech', 30 ); | ||
ApplyLeech( attacker, damaged, damageValue, iWeapon, 'staminaLeech', 100 ); | ||
ApplyLeech( attacker, damaged, damageValue, iWeapon, 'manaLeech', 40 ); | ||
} | ||
|
||
return true; | ||
} | ||
|
||
function ApplyLeech( attacker, damaged, damageValue, weapon, leechType, multiplier ) | ||
{ | ||
// Get the leech amount for the specified leech type from the weapon | ||
var leechPercentVal = weapon[ leechType ]; | ||
if( leechPercentVal > 0 ) | ||
{ | ||
// Calculate the percent of health restored to the attacker | ||
var leechAmt = Math.round( damageValue * ( leechPercentVal / 100 ) * ( multiplier/100 )); | ||
|
||
// Apply the leech effect based on the leech type | ||
switch( leechType ) | ||
{ | ||
case 'healthLeech': | ||
attacker.Heal( leechAmt ); | ||
break; | ||
case 'staminaLeech': | ||
attacker.stamina += leechAmt; | ||
break; | ||
case 'manaLeech': | ||
attacker.mana += leechAmt; | ||
break; | ||
} | ||
|
||
attacker.SoundEffect( 0x44D, true ); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.