Skip to content

Commit

Permalink
Merge pull request #1146 from kevin-10/master
Browse files Browse the repository at this point in the history
Damageable Item support
  • Loading branch information
kevin-10 committed Nov 6, 2016
2 parents 34af6c7 + 4a4edfd commit 712eea9
Show file tree
Hide file tree
Showing 117 changed files with 1,698 additions and 1,439 deletions.
30 changes: 17 additions & 13 deletions Scripts/Abilities/Abilities.cs
Expand Up @@ -241,8 +241,11 @@ public static void UseDiscord(BaseCreature from)
return;

if (from.Combatant is BaseCreature)
{
BaseCreature bc = (BaseCreature)from.Combatant;

if (from.Target != null)
from.Target.Invoke(from, from.Combatant);
from.Target.Invoke(from, bc);
else
{
double effect = -(from.Skills[SkillName.Discordance].Value / 5.0);
Expand All @@ -257,11 +260,12 @@ public static void UseDiscord(BaseCreature from)
new ResistanceMod(ResistanceType.Energy, (int)(effect * 0.01))
};

TimedResistanceMod.AddMod(from.Combatant, "Discordance", mods, duration);
from.Combatant.AddStatMod(new StatMod(StatType.Str, "DiscordanceStr", (int)(from.Combatant.RawStr * effect), duration));
from.Combatant.AddStatMod(new StatMod(StatType.Int, "DiscordanceInt", (int)(from.Combatant.RawInt * effect), duration));
from.Combatant.AddStatMod(new StatMod(StatType.Dex, "DiscordanceDex", (int)(from.Combatant.RawDex * effect), duration));
TimedResistanceMod.AddMod(bc, "Discordance", mods, duration);
bc.AddStatMod(new StatMod(StatType.Str, "DiscordanceStr", (int)(bc.RawStr * effect), duration));
bc.AddStatMod(new StatMod(StatType.Int, "DiscordanceInt", (int)(bc.RawInt * effect), duration));
bc.AddStatMod(new StatMod(StatType.Dex, "DiscordanceDex", (int)(bc.RawDex * effect), duration));
}
}
}

public class DiscordEffectTimer : Timer
Expand Down Expand Up @@ -292,7 +296,7 @@ protected override void OnTick()

public static void UsePeace(BaseCreature from)
{
if (from.Combatant == null || !CanUse(from) || !CheckBarding(from))
if (from.Combatant == null || !(from.Combatant is Mobile) || !CanUse(from) || !CheckBarding(from))
return;

if (!from.UseSkill(SkillName.Peacemaking))
Expand All @@ -315,7 +319,7 @@ public static void UsePeace(BaseCreature from)

public static void UseProvo(BaseCreature from, bool randomly)
{
if (from.Combatant == null && randomly || !CheckBarding(from))
if (((from.Combatant == null || !(from.Combatant is Mobile)) && randomly) || !CheckBarding(from))
return;

if (!CanUse(from))
Expand All @@ -332,7 +336,7 @@ public static void UseProvo(BaseCreature from, bool randomly)
if (from.Target != null)
from.Target.Invoke(from, targetone);

Mobile targettwo = randomly ? FindRandomTarget(from, randomly) : from.Combatant;
Mobile targettwo = randomly ? FindRandomTarget(from, randomly) : from.Combatant as Mobile;

if (targettwo == null)
return;
Expand All @@ -346,13 +350,13 @@ public static void UseProvo(BaseCreature from, bool randomly)
#region MimicThem
public static void MimicThem(BaseCreature from)
{
Mobile targ = from.Combatant;
Mobile targ = from.Combatant as Mobile;
MimicThem(from, false, false);
}

public static void MimicThem(BaseCreature from, bool allowskillchanges, bool allowAIchanges)
{
Mobile targ = from.Combatant;
Mobile targ = from.Combatant as Mobile;
MimicThem(from, targ, allowskillchanges, allowAIchanges);
}

Expand Down Expand Up @@ -482,7 +486,7 @@ public static void BullRush(Mobile from)

public static void BullRush(Mobile from, string text, int duration)
{
Mobile target = from.Combatant;
Mobile target = from.Combatant as Mobile;

if (target == null || CanUse(from, target))
return;
Expand Down Expand Up @@ -698,7 +702,7 @@ public static void TossBola(Mobile from)
if (from == null)
return;

Mobile target = from.Combatant;
Mobile target = from.Combatant as Mobile;

if (target == null)
return;
Expand Down Expand Up @@ -1192,7 +1196,7 @@ public static void Strike(Mobile from, int count)
if (from.Frozen || from.Paralyzed)
return;

Mobile target = from.Combatant;
Mobile target = from.Combatant as Mobile;

if (target == null)
return;
Expand Down

0 comments on commit 712eea9

Please sign in to comment.