/// <inheritdoc/> public void DeactivateMagicEffect(MagicEffect effect, IAttackable affectedObject) { this.SendMagicEffectStatus(effect, affectedObject, false, 0); }
/// <inheritdoc/> public void ActivateMagicEffect(MagicEffect effect, Player affectedPlayer) { this.SendMagicEffectStatus(effect, affectedPlayer, true, effect.Definition.SendDuration ? (uint)effect.Duration.TotalMilliseconds : 0); }
public override void AddEffect(MagicEffect effect, Position pos) { netmsg.AddByte(0x83); netmsg.AddPosition(pos); netmsg.AddByte((byte)effect); }
/// <inheritdoc/> public void ActivateMagicEffect(MagicEffect effect, IAttackable affectedObject) { this.SendMagicEffectStatus(effect, affectedObject, true, effect.Definition.SendDuration ? (uint)effect.Duration.TotalMilliseconds : 0); }
public INDX(byte[] rawData) : base(rawData) { var reader = new ByteReader(); EffectId = reader.ReadBytes <MagicEffect>(Data); }
public override void AddEffect(MagicEffect effect, Position pos) { if (CanSee(pos)) { AddAffected(); protocolS.AddEffect(effect, pos); } }
/// <summary> /// Adds a magic effect to the player's client. /// </summary> /// <param name="effect">Effect to add.</param> /// <param name="pos">Position to add the effect.</param> public override void AddEffect(MagicEffect effect, Position pos) { netmsg.AddU16(0x1A); //Magic effect header netmsg.AddPosition(pos); netmsg.AddByte((byte)effect); }
public abstract void AddEffect(MagicEffect effect, Position pos);
public override void Deserialize(GenericReader reader) { base.Deserialize(reader); int version = reader.ReadInt(); switch (version) { case 8: //erl - added to handle packing out of PlayerConstructed property { goto case 7; } case 7: //erl - added for clothing wear { m_HitPoints = reader.ReadShort(); m_MaxHitPoints = reader.ReadShort(); goto case 6; } case 6: //Adam - Addition for Scissorable attribute { m_Scissorable = reader.ReadBool(); goto case 5; } case 5: //Adam - Addition for Dyable attribute { m_Dyable = reader.ReadBool(); goto case 4; } case 4: //Pigpen - Addition for IOB System { m_IOBAlignment = (IOBAlignment)reader.ReadInt(); goto case 3; } case 3: { m_MagicType = (MagicEffect)reader.ReadInt(); m_MagicCharges = reader.ReadInt(); m_Identified = reader.ReadBool(); goto case 2; } case 2: { // erl: this is the old PlayerConstructed flag, which will no longer // exist for anything over version 7... made obsolete by PlayerCrafted if( version < 8 ) PlayerCrafted = reader.ReadBool(); goto case 1; } case 1: { m_Crafter = reader.ReadMobile(); m_Quality = (ClothingQuality)reader.ReadInt(); break; } case 0: { m_Crafter = null; m_Quality = ClothingQuality.Regular; break; } } if (version < 5) // Adam - addition for dye control { // Allow for other non-dyable clothes outside the IOB system if (m_IOBAlignment != IOBAlignment.None) m_Dyable = false; } if (version < 7) { // erl: this pre-dates hit point additions, so calculate values // .. // Check the quality of the piece. If it's exceptional or low, we want // the piece's hitpoint to reflect this int iMax = InitMaxHits; int iMin = InitMinHits; if( Quality == ClothingQuality.Exceptional ) { // Add 50% to both iMax = ( iMax * 3 ) / 2; // Fixed order of precedence bug iMin = ( iMin * 3 ) / 2; } else if(Quality == ClothingQuality.Low ) { // Lose 20% to both iMax = ( iMax * 4) / 5; // Fixed order of precedence bug iMin = ( iMin * 4) / 5; } m_HitPoints = m_MaxHitPoints = (short) Utility.RandomMinMax( iMin, iMax ); } // adam: To keep players from farming new characters for newbie clothes // we are moving this valuable resource into the hands of crafters. if (version <= 7) { if( Quality == ClothingQuality.Exceptional && MagicCharges == 0 ) { // make exceptional clothes newbied LootType = LootType.Newbied; } else if( MagicCharges > 0 ) { // erl: explicitly change these pieces so they aren't newbied LootType = LootType.Regular; } } }
public override void Deserialize(GenericReader reader) { base.Deserialize(reader); int version = reader.ReadInt(); switch (version) { case 3: { m_Identified = reader.ReadBool(); m_Uses = reader.ReadInt(); m_Effect = (MagicEffect)reader.ReadEncodedInt(); goto case 2; } case 2: { m_Resource = (CraftResource)reader.ReadEncodedInt(); m_GemType = (GemType)reader.ReadEncodedInt(); goto case 1; } case 1: { m_AosAttributes = new AosAttributes(this, reader); m_AosResistances = new AosElementAttributes(this, reader); m_AosSkillBonuses = new AosSkillBonuses(this, reader); if (Core.AOS && Parent is Mobile) { m_AosSkillBonuses.AddTo((Mobile)Parent); } int strBonus = m_AosAttributes.BonusStr; int dexBonus = m_AosAttributes.BonusDex; int intBonus = m_AosAttributes.BonusInt; if (Parent is Mobile && (strBonus != 0 || dexBonus != 0 || intBonus != 0)) { Mobile m = (Mobile)Parent; string modName = Serial.ToString(); if (strBonus != 0) { m.AddStatMod(new StatMod(StatType.Str, modName + "Str", strBonus, TimeSpan.Zero)); } if (dexBonus != 0) { m.AddStatMod(new StatMod(StatType.Dex, modName + "Dex", dexBonus, TimeSpan.Zero)); } if (intBonus != 0) { m.AddStatMod(new StatMod(StatType.Int, modName + "Int", intBonus, TimeSpan.Zero)); } } if (Parent is Mobile) { ((Mobile)Parent).CheckStatTimers(); } break; } case 0: { m_AosAttributes = new AosAttributes(this); m_AosResistances = new AosElementAttributes(this); m_AosSkillBonuses = new AosSkillBonuses(this); break; } } if (version < 2) { m_Resource = CraftResource.Iron; m_GemType = GemType.None; } if (version < 3) { m_Effect = MagicEffect.None; m_Identified = false; m_Uses = 0; } }
public BaseClothing(int itemID, Layer layer, int hue) : base( itemID ) { Layer = layer; Hue = hue; m_Quality = ClothingQuality.Regular; m_MagicType = MagicEffect.None; m_MagicCharges = 0; m_Identified = true; m_IOBAlignment = IOBAlignment.None; //Pigpen - Addition for IOB System m_InvisTimer = null; m_StatEffectTimer = null; m_Dyable = true; //Froste - Addition for dye control m_Scissorable = true; // Adam - Addition for better Scissor control // erl: added for clothing wear m_HitPoints = m_MaxHitPoints = (short) Utility.RandomMinMax( InitMinHits, InitMaxHits ); }
public void SetRandomMagicEffect(int MinLevel, int MaxLevel) { if (IsMagicAllowed()) { if (MinLevel < 1 || MaxLevel > 3) return; int NewMagicType; // list all supported magic types NewMagicType = Utility.RandomList((int)MagicEffect.MagicReflect, (int)MagicEffect.Invisibility, (int)MagicEffect.Bless, (int)MagicEffect.Agility, (int)MagicEffect.Cunning, (int)MagicEffect.Strength, (int)MagicEffect.NightSight); m_MagicType = (MagicEffect)NewMagicType; int NewLevel = Utility.RandomMinMax(MinLevel, MaxLevel); switch (NewLevel) { case 1: m_MagicCharges = Utility.Random(1, 5); break; case 2: m_MagicCharges = Utility.Random(4, 11); break; case 3: m_MagicCharges = Utility.Random(9, 20); break; default: // should never happen m_MagicCharges = 0; break; } Identified = false; } }
public void SetMagic(MagicEffect Effect, int Charges) { if (IsMagicAllowed()) { m_MagicType = Effect; m_MagicCharges = Charges; Identified = false; } }
/// <inheritdoc/> public void DeactivateMagicEffect(MagicEffect effect, Player affectedPlayer) { this.SendMagicEffectStatus(effect, affectedPlayer, false, 0); }
/// <summary> /// Adds a magic effect at the given position. /// </summary> /// <param name="effect">The effect to add.</param> /// <param name="position">Add effect at this position.</param> public void AddMagicEffect(MagicEffect effect, Position position) { ThingSet tSet = gameMap.GetThingsInVicinity(position); foreach (Thing thing in tSet.GetThings()) { thing.AddEffect(effect, position); } }
public override void Deserialize(GenericReader reader) { base.Deserialize(reader); int version = reader.ReadInt(); switch (version) { case 8: //erl - added to handle packing out of PlayerConstructed property { goto case 7; } case 7: //erl - added for clothing wear { m_HitPoints = reader.ReadShort(); m_MaxHitPoints = reader.ReadShort(); goto case 6; } case 6: //Adam - Addition for Scissorable attribute { m_Scissorable = reader.ReadBool(); goto case 5; } case 5: //Adam - Addition for Dyable attribute { m_Dyable = reader.ReadBool(); goto case 4; } case 4: //Pigpen - Addition for IOB System { m_IOBAlignment = (IOBAlignment)reader.ReadInt(); goto case 3; } case 3: { m_MagicType = (MagicEffect)reader.ReadInt(); m_MagicCharges = reader.ReadInt(); m_Identified = reader.ReadBool(); goto case 2; } case 2: { // erl: this is the old PlayerConstructed flag, which will no longer // exist for anything over version 7... made obsolete by PlayerCrafted if (version < 8) { PlayerCrafted = reader.ReadBool(); } goto case 1; } case 1: { m_Crafter = reader.ReadMobile(); m_Quality = (ClothingQuality)reader.ReadInt(); break; } case 0: { m_Crafter = null; m_Quality = ClothingQuality.Regular; break; } } if (version < 5) // Adam - addition for dye control { // Allow for other non-dyable clothes outside the IOB system if (m_IOBAlignment != IOBAlignment.None) { m_Dyable = false; } } if (version < 7) { // erl: this pre-dates hit point additions, so calculate values // .. // Check the quality of the piece. If it's exceptional or low, we want // the piece's hitpoint to reflect this int iMax = InitMaxHits; int iMin = InitMinHits; if (Quality == ClothingQuality.Exceptional) { // Add 50% to both iMax = (iMax * 3) / 2; // Fixed order of precedence bug iMin = (iMin * 3) / 2; } else if (Quality == ClothingQuality.Low) { // Lose 20% to both iMax = (iMax * 4) / 5; // Fixed order of precedence bug iMin = (iMin * 4) / 5; } m_HitPoints = m_MaxHitPoints = (short)Utility.RandomMinMax(iMin, iMax); } // adam: To keep players from farming new characters for newbie clothes // we are moving this valuable resource into the hands of crafters. if (version <= 7) { if (Quality == ClothingQuality.Exceptional && MagicCharges == 0) { // make exceptional clothes newbied LootType = LootType.Newbied; } else if (MagicCharges > 0) { // erl: explicitly change these pieces so they aren't newbied LootType = LootType.Regular; } } }
/// <summary> /// Used for handling posion damage, fire damage, etc. Note: Sends protocol data. /// Returns the new damages to set. /// </summary> /// <param name="creature"></param> private int[] HandleDamageEffectCheck(Creature creature, int[] dmgs, MagicEffect effect, ImmunityType type) { if (!creature.LogedIn || dmgs == null) { return null; } AddMagicEffect(effect, creature.CurrentPosition); int[] newDmgs = null; int dmg = dmgs[0]; if (dmgs.Length > 1) { newDmgs = new int[dmgs.Length - 1]; for (int i = 1; i < dmgs.Length; i++) { newDmgs[i - 1] = dmgs[i]; } } AppendAddDamage(null, creature, dmg, type, true); SendProtocolMessages(); return newDmgs; }
public override void Deserialize( GenericReader reader ) { base.Deserialize( reader ); int version = reader.ReadInt(); switch ( version ) { case 3: { m_Identified = reader.ReadBool(); m_Uses = reader.ReadInt(); m_Effect = (MagicEffect)reader.ReadEncodedInt(); goto case 2; } case 2: { m_Resource = (CraftResource)reader.ReadEncodedInt(); m_GemType = (GemType)reader.ReadEncodedInt(); goto case 1; } case 1: { m_AosAttributes = new AosAttributes( this, reader ); m_AosResistances = new AosElementAttributes( this, reader ); m_AosSkillBonuses = new AosSkillBonuses( this, reader ); if ( Core.AOS && Parent is Mobile ) m_AosSkillBonuses.AddTo( (Mobile)Parent ); int strBonus = m_AosAttributes.BonusStr; int dexBonus = m_AosAttributes.BonusDex; int intBonus = m_AosAttributes.BonusInt; if ( Parent is Mobile && (strBonus != 0 || dexBonus != 0 || intBonus != 0) ) { Mobile m = (Mobile)Parent; string modName = Serial.ToString(); if ( strBonus != 0 ) m.AddStatMod( new StatMod( StatType.Str, modName + "Str", strBonus, TimeSpan.Zero ) ); if ( dexBonus != 0 ) m.AddStatMod( new StatMod( StatType.Dex, modName + "Dex", dexBonus, TimeSpan.Zero ) ); if ( intBonus != 0 ) m.AddStatMod( new StatMod( StatType.Int, modName + "Int", intBonus, TimeSpan.Zero ) ); } if ( Parent is Mobile ) ((Mobile)Parent).CheckStatTimers(); break; } case 0: { m_AosAttributes = new AosAttributes( this ); m_AosResistances = new AosElementAttributes( this ); m_AosSkillBonuses = new AosSkillBonuses( this ); break; } } if ( version < 2 ) { m_Resource = CraftResource.Iron; m_GemType = GemType.None; } if ( version < 3 ) { m_Effect = MagicEffect.None; m_Identified = false; m_Uses = 0; } }
/// <summary> /// Lets this thing know that a magic effect has occured. /// </summary> /// <param name="effect">The effect.</param> /// <param name="pos">The position of the ffect.</param> public virtual void AddEffect(MagicEffect effect, Position pos) { }