public override void OnDamage(int amount, Mobile from, bool willKill) { if (!willKill && amount >= this.Hits / 4 && this.Hits >= this.HitsMax / 2 && Utility.RandomBool()) { Slime s = new Slime(); s.Combatant = from; s.SetHits(this.HitsMax); s.Hits = (this.Hits - amount) / 2; if (s.Hits <= 0) { s.Hits = 1; } this.Hits = s.Hits; s.Hue = this.Hue; s.MoveToWorld(Location, Map); while (s.Backpack != null && s.Backpack.Items.Count > 0) { ((Item)s.Backpack.Items[0]).Delete(); } s.Emote("*The slime splits when struck!*"); this.PlaySound(Utility.Random(5) + 456); } base.OnDamage(amount, from, willKill); }
public override void OnGotMeleeAttack(Mobile attacker) { if (attacker != this && this.Hits > 1) { Mobile spawn = new Slime(); spawn.MoveToWorld(this.Location, this.Map); this.Hits /= 2; spawn.Hits = this.Hits; //this.SetHits(this.m_HitsMax / 2); //spawn.SetHits(this.m_HitsMax); Say("The Slime splits into two!"); } base.OnGotMeleeAttack(attacker); }
public virtual void OnHit( Mobile attacker, Mobile defender, double damageBonus ) { PlayHurtAnimation( defender ); attacker.PlaySound( GetHitAttackSound( attacker, defender ) ); defender.PlaySound( GetHitDefendSound( attacker, defender ) ); int damage = ComputeDamage( attacker, defender ); if (Effect != WeaponEffect.None && Charges > 0) { #region Magic Weapon Effects if (Effect == WeaponEffect.Clumsy) { string name = String.Format("[Magic] {0} Offset", StatType.Dex); StatMod mod = defender.GetStatMod(name); if (mod != null && mod.Offset < 0) defender.AddStatMod(new StatMod(StatType.Dex, name, mod.Offset + -10, TimeSpan.FromSeconds(60.0))); else if (mod == null || mod.Offset < -10) defender.AddStatMod(new StatMod(StatType.Dex, name, -10, TimeSpan.FromSeconds(60.0))); Charges--; defender.FixedParticles(0x3779, 10, 15, 5002, EffectLayer.Head); defender.PlaySound(0x1DF); } else if (Effect == WeaponEffect.Feeblemind) { string name = String.Format("[Magic] {0} Offset", StatType.Int); StatMod mod = defender.GetStatMod(name); if (mod != null && mod.Offset < 0) defender.AddStatMod(new StatMod(StatType.Int, name, mod.Offset + -10, TimeSpan.FromSeconds(60.0))); else if (mod == null || mod.Offset < 10) defender.AddStatMod(new StatMod(StatType.Int, name, -10, TimeSpan.FromSeconds(60.0))); Charges--; defender.FixedParticles(0x3779, 10, 15, 5004, EffectLayer.Head); defender.PlaySound(0x1E4); } else if (Effect == WeaponEffect.MagicArrow) { DoMagicArrow(attacker, defender); Charges--; /*attacker.MovingParticles(defender, 0x36E4, 5, 0, false, true, 3006, 4006, 0); attacker.PlaySound(0x1E5);*/ } else if (Effect == WeaponEffect.Weakness) { string name = String.Format("[Magic] {0} Offset", StatType.Str); StatMod mod = defender.GetStatMod(name); if (mod != null && mod.Offset < 0) defender.AddStatMod(new StatMod(StatType.Str, name, mod.Offset + -10, TimeSpan.FromSeconds(60.0))); else if (mod == null || mod.Offset < 10) defender.AddStatMod(new StatMod(StatType.Str, name, -10, TimeSpan.FromSeconds(60.0))); Charges--; defender.FixedParticles(0x3779, 10, 15, 5009, EffectLayer.Waist); defender.PlaySound(0x1E6); } else if (Effect == WeaponEffect.Harm) { DoHarm(attacker, defender); Charges--; /*defender.FixedParticles(0x374A, 10, 15, 5013, EffectLayer.Waist); defender.PlaySound(0x1F1);*/ } else if (Effect == WeaponEffect.Paralyze) { defender.Paralyze(TimeSpan.FromSeconds(7)); Charges--; defender.PlaySound(0x204); defender.FixedEffect(0x376A, 6, 1); } else if (Effect == WeaponEffect.Fireball) { DoFireball(attacker, defender); Charges--; /*attacker.MovingParticles(defender, 0x36D4, 7, 0, false, true, 9502, 4019, 0x160); attacker.PlaySound(0x15E);*/ } else if (Effect == WeaponEffect.Curse) { string nameS = String.Format("[Magic] {0} Offset", StatType.Str); string nameD = String.Format("[Magic] {0} Offset", StatType.Dex); string nameI = String.Format("[Magic] {0} Offset", StatType.Int); StatMod strmod = defender.GetStatMod(nameS); StatMod dexmod = defender.GetStatMod(nameD); StatMod intmod = defender.GetStatMod(nameI); if (strmod != null && strmod.Offset > 0) defender.AddStatMod(new StatMod(StatType.Str, nameS, strmod.Offset + -10, TimeSpan.FromSeconds(60.0))); else if (strmod == null || strmod.Offset > 10) defender.AddStatMod(new StatMod(StatType.Str, nameS, -10, TimeSpan.FromSeconds(60.0))); if (dexmod != null && dexmod.Offset > 0) defender.AddStatMod(new StatMod(StatType.Dex, nameD, dexmod.Offset + -10, TimeSpan.FromSeconds(60.0))); else if (dexmod == null || dexmod.Offset > 10) defender.AddStatMod(new StatMod(StatType.Dex, nameD, -10, TimeSpan.FromSeconds(60.0))); if (intmod != null && intmod.Offset > 0) defender.AddStatMod(new StatMod(StatType.Int, nameI, intmod.Offset + -10, TimeSpan.FromSeconds(60.0))); else if (intmod == null || intmod.Offset > 10) defender.AddStatMod(new StatMod(StatType.Int, nameI, -10, TimeSpan.FromSeconds(60.0))); Charges--; defender.FixedParticles(0x374A, 10, 15, 5028, EffectLayer.Waist); defender.PlaySound(0x1EA); } else if (Effect == WeaponEffect.ManaDrain) { defender.Mana -= 10; Charges--; defender.FixedParticles(0x374A, 10, 15, 5032, EffectLayer.Head); defender.PlaySound(0x1F8); } else if (Effect == WeaponEffect.Lightning) { DoLightning(attacker, defender); Charges--; /*defender.BoltEffect(0);*/ } #endregion } CheckSlayerResult cs = CheckSlayers( attacker, defender ); if ( cs != CheckSlayerResult.None ) { if ( cs == CheckSlayerResult.Slayer ) defender.FixedEffect( 0x37B9, 10, 5 ); damage *= 2; } if ( attacker is BaseCreature ) ((BaseCreature)attacker).AlterMeleeDamageTo( defender, ref damage ); if ( defender is BaseCreature ) ((BaseCreature)defender).AlterMeleeDamageFrom( attacker, ref damage ); damage = AbsorbDamage( attacker, defender, damage ); // Halve the computed damage and return damage /= 2; if (damage < 1) damage = 1; if (attacker is PlayerMobile) damage += 2; AddBlood( attacker, defender, damage ); defender.Damage(damage, attacker); if (defender is Slime) { if ((damage > (defender.Hits / 4)) && (defender.Hits > 5)) { defender.Say(true, "*The slime splits when struck!*"); BaseCreature slime = new Slime(); slime.Hits = (defender.Hits / 2); defender.Hits /= 2; slime.MoveToWorld(new Point3D(defender.X, defender.Y, defender.Z), defender.Map); } } Item hammer = attacker.FindItemOnLayer(Layer.OneHanded); if ( (m_MaxHits > 0 || (hammer != null && hammer is SmithHammer && ((SmithHammer)hammer).MaxHitPoints > 0)) && ((MaxRange <= 1 && (defender is Slime || defender is ToxicElemental)) || Utility.Random( 25 ) == 0) ) // Stratics says 50% chance, seems more like 4%.. { if ((MaxRange <= 1 || (hammer != null && hammer is SmithHammer)) && (defender is Slime || defender is ToxicElemental)) attacker.LocalOverheadMessage( MessageType.Regular, 0x3B2, true, "*Acid blood scars your weapon!*" ); if (( m_Hits > 0 ) || (hammer != null && hammer is SmithHammer && ((SmithHammer)hammer).HitPoints > 0)) { --HitPoints; } else if (( m_MaxHits > 1 ) || (hammer != null && hammer is SmithHammer && ((SmithHammer)hammer).MaxHitPoints > 1)) { --MaxHitPoints; if ( Parent is Mobile ) ((Mobile)Parent).LocalOverheadMessage( MessageType.Regular, 0x3B2, true, "Your equipment is severely damaged." ); } else { Delete(); } } if ( attacker is BaseCreature ) ((BaseCreature)attacker).OnGaveMeleeAttack( defender ); if ( defender is BaseCreature ) ((BaseCreature)defender).OnGotMeleeAttack( attacker ); }
public override void OnDamage( int amount, Mobile from, bool willKill ) { if ( !willKill && amount >= this.Hits/4 && this.Hits >= this.HitsMax / 2 && Utility.RandomBool() ) { Slime s = new Slime(); s.Combatant = from; s.SetHits( this.HitsMax ); s.Hits = (this.Hits-amount) / 2; if ( s.Hits <= 0 ) s.Hits = 1; this.Hits = s.Hits; s.Hue = this.Hue; s.MoveToWorld( Location, Map ); while ( s.Backpack != null && s.Backpack.Items.Count > 0 ) ((Item)s.Backpack.Items[0]).Delete(); s.Emote( "*The slime splits when struck!*" ); this.PlaySound( Utility.Random( 5 ) + 456 ); } base.OnDamage( amount, from, willKill ); }