A set of items that can be carried on a player or a creature that provide events to occure automatically as long as they are being carried. Each item has a seperate cooldown and percent chance that an event may occure.
It is setup right now so it works if it is in a players backpack while fighting creatures. Or if its in a creatures backpack fighting other creatures. It is not setup for Player vs Player but it is an easy addition.
Blade Spirit
Description: Summons a blade spirit to assist the mobile. Acts as a summoned pet.
Cooldown: 60s
Chance: 5%
Druid
Description: Heals a mobile based on a random chance each time they take damage
Cooldown: 60s
Chance: 5%
Lightning
Description: Summons a lightning bolt to hit your target
Cooldown: 10s
Chance: 5%
Dragon
Description: Summons a dragon to help the mobile. Acts as a summoned pet.
Cooldown: 60s
Chance: 1%
Treasure Goblin
Description: Give the player a small random amount of gold
Cooldown: 60s
Chance: 5%
BaseCreature.cs
Inside the "public override void OnDamage(int amount, Mobile from, bool willKill)" function. At the very bottom above "base.OnDamage(amount, from, willKill);"
PlayerMobile.cs
Inside the "public override void OnDamage(int amount, Mobile from, bool willKill)" function. At the very bottom above "base.OnDamage(amount, from, willKill);"
It is setup right now so it works if it is in a players backpack while fighting creatures. Or if its in a creatures backpack fighting other creatures. It is not setup for Player vs Player but it is an easy addition.
Blade Spirit
Description: Summons a blade spirit to assist the mobile. Acts as a summoned pet.
Cooldown: 60s
Chance: 5%
Druid
Description: Heals a mobile based on a random chance each time they take damage
Cooldown: 60s
Chance: 5%
Lightning
Description: Summons a lightning bolt to hit your target
Cooldown: 10s
Chance: 5%
Dragon
Description: Summons a dragon to help the mobile. Acts as a summoned pet.
Cooldown: 60s
Chance: 1%
Treasure Goblin
Description: Give the player a small random amount of gold
Cooldown: 60s
Chance: 5%
BaseCreature.cs
Inside the "public override void OnDamage(int amount, Mobile from, bool willKill)" function. At the very bottom above "base.OnDamage(amount, from, willKill);"
Code:
#region Natfoth Passive Item System Edit #1
if (from != null && from.Backpack != null && from.Backpack.Items.Count > 0) {
//Check damage given first
var passiveItems = from.Backpack.FindItemsByType(typeof(BasePassiveItem)).ToList();
foreach (var passiveItem in passiveItems) {
((BasePassiveItem)passiveItem).OnDamageGiven(this, amount, from, willKill);
}
//Then check for damage received in MVM
if (Backpack != null) {
passiveItems = Backpack.FindItemsByType(typeof(BasePassiveItem)).ToList();
foreach (var passiveItem in passiveItems) {
((BasePassiveItem) passiveItem).OnDamageReceived(this, amount, from, willKill);
}
}
}
#endregion
PlayerMobile.cs
Inside the "public override void OnDamage(int amount, Mobile from, bool willKill)" function. At the very bottom above "base.OnDamage(amount, from, willKill);"
Code:
#region Natfoth Passive Item System Edit #2
if (Backpack != null && Backpack.Items.Count > 0) {
var passiveItems = Backpack.FindItemsByType(typeof(BasePassiveItem)).ToList();
foreach (var passiveItem in passiveItems) {
((BasePassiveItem) passiveItem).OnDamageReceived(this, amount, from, willKill);
}
}
#endregion