Пример #1
0
        internal static void add_affect(bool call_spell_jump_list, int data, ushort minutes, Affects type, Player player)
        {
            Affect affect = new Affect(type, minutes, (byte)data, call_spell_jump_list);

            player.affects.Add(affect);
            //TODO simplify this funcation.
        }
Пример #2
0
 internal static bool addAffect(ushort time, int data, Affects affect_type, Player player)
 {
     if (gbl.cureSpell == true)
     {
         return false;
     }
     else
     {
         ovr024.add_affect(true, data, time, affect_type, player);
         return true;
     }
 }
Пример #3
0
        public void Clear()
        {
            name = string.Empty;

            type              = 0;
            namenum1          = 0;
            namenum2          = 0;
            namenum3          = 0;
            plus              = 0;
            plus_save         = 0;
            readied           = false;
            hidden_names_flag = 0;
            cursed            = false;
            weight            = 0;
            count             = 0;
            _value            = 0;
            affect_1          = 0;
            affect_2          = 0;
            affect_3          = 0;
        }
Пример #4
0
        public Item(byte[] data, int offset)
        {
            name = Sys.ArrayToString(data, offset, 0x2a);

            type              = (ItemType)data[offset + 0x2e];
            namenum1          = data[offset + 0x2f];
            namenum2          = data[offset + 0x30];
            namenum3          = data[offset + 0x31];
            plus              = (sbyte)data[offset + 0x32];
            plus_save         = data[offset + 0x33];
            readied           = (data[offset + 0x34] != 0);
            hidden_names_flag = data[offset + 0x35];
            cursed            = (data[offset + 0x36] != 0);

            weight   = Sys.ArrayToShort(data, offset + 0x37);
            count    = data[offset + 0x39];
            _value   = Sys.ArrayToShort(data, offset + 0x3a);
            affect_1 = (Affects)data[offset + 0x3C];
            affect_2 = (Affects)data[offset + 0x3D];
            affect_3 = (Affects)data[offset + 0x3E];

            ItemLibrary.Add(this);
            //AddItemsText(string.Format("{0},{1},{2},{3},{4}", type, namenum1, namenum2, namenum3, GenerateName(0)));
        }
Пример #5
0
        internal static void remove_affect(Affect affect, Affects affect_id, Player player)
        {
            if (affect == null)
            {
                affect = player.GetAffect(affect_id);
            }

            if (affect != null)
            {
                if (affect.callAffectTable == true)
                {
                    ovr013.CallAffectTable(Effect.Remove, affect, player, affect_id);
                }

                player.affects.Remove(affect);

                if (affect_id == Affects.resist_fire)
                {
                    CalcStatBonuses(Stat.CHA, player);
                }

                if (affect_id == Affects.enlarge ||
                    affect_id == Affects.strength ||
                    affect_id == Affects.strength_spell)
                {
                    CalcStatBonuses(Stat.STR, player);
                }
            }
        }
Пример #6
0
 public void AddAffect(SmaugAffect affect)
 {
     Affects.Add(affect);
 }
Пример #7
0
 public void setAffect(int i, Affects value)
 {
     switch (i)
     {
         case 1:
             affect_1 = value;
             break;
         case 2:
             affect_2 = value;
             break;
         case 3:
             affect_3 = value;
             break;
         default:
             throw new System.ArgumentOutOfRangeException();
     }
 }
Пример #8
0
        public Item(byte[] data, int offset)
        {
            name = Sys.ArrayToString(data, offset, 0x2a);

            type = (ItemType)data[offset + 0x2e];
            namenum1 = data[offset + 0x2f];
            namenum2 = data[offset + 0x30];
            namenum3 = data[offset + 0x31];
            plus = (sbyte)data[offset + 0x32];
            plus_save = data[offset + 0x33];
            readied = (data[offset + 0x34] != 0);
            hidden_names_flag = data[offset + 0x35];
            cursed = (data[offset + 0x36] != 0);

            weight = Sys.ArrayToShort(data, offset + 0x37);
            count = data[offset + 0x39];
            _value = Sys.ArrayToShort(data, offset + 0x3a);
            affect_1 = (Affects)data[offset + 0x3C];
            affect_2 = (Affects)data[offset + 0x3D];
            affect_3 = (Affects)data[offset + 0x3E];

            ItemLibrary.Add(this);
            //AddItemsText(string.Format("{0},{1},{2},{3},{4}", type, namenum1, namenum2, namenum3, GenerateName(0)));
        }
Пример #9
0
 public static void RegisterEffect <TComponent1, TComponent2, TComponent3>(this IEffectApi @this, Affects affects)
 {
     @this.RegisterEffect <TComponent1>(affects);
     @this.RegisterEffect <TComponent2>(affects);
     @this.RegisterEffect <TComponent3>(affects);
 }
Пример #10
0
 public Poke_objects(ToolStripMenuItem menu_plc, string value_name, uint offsetx, string typex, string init, string alte, Affects effe)
 {
     effects        = Affects.Default;
     menu_placement = menu_plc;
     poke_name      = value_name;
     poke_offset    = offsetx;
     poke_type      = typex;
     poke_initial   = init;
     poke_altered   = alte;
     effects        = effe;
 }
Пример #11
0
 public Poke_objects(ToolStripMenuItem menu_plc, string value_name)
 {
     effects        = Affects.Default;
     menu_placement = menu_plc;
     poke_name      = value_name;
 }
Пример #12
0
 public void AddAffect(AffectData affect) => Affects.Add(affect);
Пример #13
0
        /* sub_630C7 */
        internal static void CallAffectTable(Effect add_remove, object parameter, Player player, Affects affect)
        {
            if (gbl.applyItemAffect == true)
            {
                affect = Affects.do_items_affect;
            }

            affectDelegate func;
            if (affect_table.TryGetValue(affect, out func))
            {
                func(add_remove, parameter, player);
            }
        }
Пример #14
0
 /* sub_3A019 */
 /// <summary>
 /// If same as current affect damage set to zero, or if affect is zero
 /// </summary>
 static void ProtectedIf(Affects affect)
 {
     if (gbl.current_affect == affect)
     {
         Protected();
     }
 }
Пример #15
0
 public Affect GetAffect(Affects type)
 {
     return affects.Find(aff => aff.type == type);
 }
Пример #16
0
        internal static bool FindAffect(out Affect affectFound, Affects affect_type, Player player)
        {
            affectFound = player.affects.Find(aff => aff.type == affect_type);

            return(affectFound != null);
        }
Пример #17
0
 public ArenaModifier(Affects affects)
 {
     AffectsArena = affects;
 }
Пример #18
0
        public static void RegisterEffectSystems <TSystem, TRenderer, TComponent1, TComponent2, TComponent3, TComponent4, TComponent5>(this IEffectApi @this, Affects affects)
            where TSystem : IEffectSystem, new()
            where TRenderer : IEffectRenderer, new()
        {
            var system   = new TSystem();
            var renderer = new TRenderer();

            @this.RegisterEffect <TComponent1, TComponent2, TComponent3, TComponent4, TComponent5>(system, renderer, affects);
        }
Пример #19
0
 public void RegisterEffect <TAssociatedComponent>(IEffectSystem system, IEffectRenderer renderer, Affects affects)
 {
     this.componentAffectsMap[typeof(TAssociatedComponent)] = affects;
     this.affectSystem.RegisterSystem(system);
     this.affectRenderSystem.RegisterRenderer(renderer);
 }
Пример #20
0
        public Item(Affects _affect_3, Affects _affect_2, Affects _affect_1, short __value, byte _count,
            short _weight, bool _cursed, byte _name_flags, bool _readied, byte _plus_save, sbyte _plus, byte _namenum3,
            byte _namenum2, byte _namenum1, ItemType _type, bool AddToLibrary)
        {
            name = string.Empty;
            type = _type;
            namenum1 = _namenum1;
            namenum2 = _namenum2;
            namenum3 = _namenum3;
            plus = _plus;
            plus_save = _plus_save;
            readied = _readied;
            hidden_names_flag = _name_flags;
            cursed = _cursed;
            weight = _weight;
            count = _count;
            _value = __value;
            affect_1 = _affect_1;
            affect_2 = _affect_2;
            affect_3 = _affect_3;

            if (AddToLibrary)
            {
                ItemLibrary.Add(this);
            }
        }
Пример #21
0
 public void RegisterEffect <TAssociatedComponent>(Affects affects)
 {
     this.componentAffectsMap[typeof(TAssociatedComponent)] = affects;
 }
Пример #22
0
        public void Clear()
        {
            name = string.Empty;

            type = 0;
            namenum1 = 0;
            namenum2 = 0;
            namenum3 = 0;
            plus = 0;
            plus_save = 0;
            readied = false;
            hidden_names_flag = 0;
            cursed = false;
            weight = 0;
            count = 0;
            _value = 0;
            affect_1 = 0;
            affect_2 = 0;
            affect_3 = 0;
        }
Пример #23
0
 public bool HasAffect(Affects type)
 {
     return(affects.Exists(aff => aff.type == type));
 }
Пример #24
0
        internal void ApplyAffect(AffectData affect, bool adding = true)
        {
            // Add the affect to the list
            Affects.Add(affect);

            // Add/remove the affect flag to the appropriate property
            switch (affect.Where)
            {
            case ToWhere.Affects:
                if (adding)
                {
                    this.AffectedBy |= (AffectedByFlag)affect.BitVector;
                }
                else
                {
                    this.AffectedBy &= ~(AffectedByFlag)affect.BitVector;
                }

                break;

            case ToWhere.Vuln:
                if (adding)
                {
                    this.Vulnerability |= (VulnerabilityFlag)affect.BitVector;
                }
                else
                {
                    this.Vulnerability &= ~(VulnerabilityFlag)affect.BitVector;
                }

                break;

            case ToWhere.Resist:
                if (adding)
                {
                    this.Resist |= (ResistanceFlag)affect.BitVector;
                }
                else
                {
                    this.Resist &= ~(ResistanceFlag)affect.BitVector;
                }
                break;

            case ToWhere.Immune:
                if (adding)
                {
                    this.Immunity |= (ImmunityFlag)affect.BitVector;
                }
                else
                {
                    this.Immunity &= ~(ImmunityFlag)affect.BitVector;
                }

                break;
            }

            // Set the modifier
            int modifier = affect.Modifier;

            // If we're removing, reverse the modifier
            if (!adding)
            {
                modifier *= -1;
            }

            // Apply the modifier to the appropriate location
            switch (affect.Location)
            {
            case ApplyType.None:
                break;

            case ApplyType.Strength:
                this.ModifiedStats.Strength += modifier;
                break;

            case ApplyType.Dexterity:
                this.ModifiedStats.Dexterity += modifier;
                break;

            case ApplyType.Intelligence:
                this.ModifiedStats.Intelligence += modifier;
                break;

            case ApplyType.Wisdom:
                this.ModifiedStats.Wisdom += modifier;
                break;

            case ApplyType.Constitution:
                this.ModifiedStats.Constitution += modifier;
                break;

            case ApplyType.Gender:
                // Calculate the new gender value
                int newGenderVal = (int)this.Gender.GenderCode + modifier;

                // Attempt to locate a matching new gender value
                Gender newGender = Consts.Gender.GenderTable.SingleOrDefault(g => (int)g.GenderCode == newGenderVal);

                if (newGender != null)
                {
                    this.Gender = newGender;
                }
                else
                {
                    throw new ArgumentException("Unable to find new gender matching modified value " + newGenderVal);
                }

                break;

            case ApplyType.Class:
                break;

            case ApplyType.Level:
                break;

            case ApplyType.Age:
                break;

            case ApplyType.Height:
                break;

            case ApplyType.Weight:
                break;

            case ApplyType.Health:
                this.MaxHealth += modifier;
                break;

            case ApplyType.Mana:
                this.MaxMana += modifier;
                break;

            case ApplyType.Movement:
                this.MaxMove += modifier;
                break;

            case ApplyType.Gold:
                break;

            case ApplyType.Experience:
                break;

            case ApplyType.AC:
                this.Armor.Modify(modifier);
                break;

            case ApplyType.HitRoll:
                this.HitRoll += modifier;
                break;

            case ApplyType.DamageRoll:
                this.DamRoll += modifier;
                break;

            // There is actually only one saving throw stat, all feed into it
            case ApplyType.Saves:
            case ApplyType.Saving_Rod:
            case ApplyType.Saving_Spell:
            case ApplyType.Saving_Breath:
            case ApplyType.Saving_Paralyze:
            case ApplyType.Saving_Petrification:
                this.SavingThrow += modifier;
                break;

            case ApplyType.SpellAffect:
                break;
            }

            // Check if the PC is wielding a weapon heavier than their maximum wield weight; if so, drop the item (can happens as strength-boosting effects drop, for example)
            if (!IsNPC && Equipment.Wield != null &&
                Equipment.Wield.Weight > Consts.AttributeBonuses.StrengthBonusTable[GetEffectiveStat(Enums.Attribute.Strength)].Wield * 10)
            {
                // Drop the item
                // TODO: Implement
            }
        }
Пример #25
0
 public Affect GetAffect(Affects type)
 {
     return(affects.Find(aff => aff.type == type));
 }
Пример #26
0
        internal static void is_unaffected(string text, bool saved, DamageOnSave can_save, bool call_affect_table, int data, ushort time, Affects affect_id, Player target)
        {
            gbl.current_affect = affect_id;

            CheckAffectsEffect(target, CheckType.Type_9);

            if (gbl.current_affect == 0 ||
                (saved == true && can_save == DamageOnSave.Zero))
            {
                ovr025.DisplayPlayerStatusString(true, 10, "is Unaffected", target);
            }
            else
            {
                Affect found_affect;

                if (ovr025.FindAffect(out found_affect, affect_id, target) == true &&
                    found_affect.minutes > 0)
                {
                    remove_affect(found_affect, affect_id, target);
                }

                add_affect(call_affect_table, data, time, affect_id, target);

                if (text.Length != 0)
                {
                    ovr025.MagicAttackDisplay(text, true, target);
                    ovr025.ClearPlayerTextArea();
                }
            }
        }
Пример #27
0
 public Affect(Affects _type, ushort _minutes, byte _affect_data, bool _call_spell_jump_list)
 {
     type = _type;
     minutes = _minutes;
     affect_data = _affect_data;
     callAffectTable = _call_spell_jump_list;
 }
Пример #28
0
        internal static void calc_affect_effect(Affects affect_type, Player player)
        {
            bool found = false;

            Affect affect;
            if (ovr025.FindAffect(out affect, affect_type, player) == true)
            {
                found = true;
            }
            else if (System.Array.Exists(unk_6325A, vv => vv ==affect_type) == true)
            {
                foreach (Player team_member in gbl.TeamList)
                {
                    if (found) break;

                    if (ovr025.FindAffect(out affect, affect_type, team_member) == true)
                    {
                        if (gbl.game_state == GameState.Combat)
                        {
                            int max_range = (affect_type == Affects.prayer) ? 6 : 1;

                            var scl = ovr032.Rebuild_SortedCombatantList(team_member, max_range, p => p == player);

                            found = scl.Count > 0;
                        }
                        else
                        {
                            found = true;
                        }
                    }
                }
            }

            if (found == true)
            {
                ovr013.CallAffectTable(Effect.Add, affect, player, affect_type);
            }
        }
Пример #29
0
 public Affect(byte[] data, int offset)
 {
     type = (Affects)data[offset + 0x0];
     minutes = Sys.ArrayToUshort(data, offset + 0x1);
     affect_data = data[offset + 0x3];
     callAffectTable = (data[offset + 0x4] != 0);
 }
Пример #30
0
        /* is_cured */
        internal static bool cure_affect(Affects affectId, Player player)
        {
            Affect affect = player.GetAffect(affectId);
            if (affect != null)
            {
                ovr025.DisplayPlayerStatusString(true, 10, "is Cured", player);

                remove_affect(affect, affectId, player);

                return true;
            }

            return false;
        }
Пример #31
0
        internal static bool FindAffect(out Affect affectFound, Affects affect_type, Player player)
        {
            affectFound = player.affects.Find(aff => aff.type == affect_type);

            return affectFound != null;
        }
Пример #32
0
 public bool HasAffect(Affects type)
 {
     return affects.Exists(aff => aff.type == type);
 }
Пример #33
0
        //sub_5F87B
        internal static void RemoveComplimentSpellFirst(string text, CombatTeam combatTeam, Affects affect)
        {
            gbl.byte_1D2C7 = true;

            int maxTargets = ovr025.spellMaxTargetCount(gbl.spell_id);

            gbl.spellTargets.RemoveAll(target =>
                {
                    if (target.combat_team == combatTeam && maxTargets > 0)
                    {
                        maxTargets -= 1;

                        if (ovr024.cure_affect(affect, target) == true)
                        {
                            return true;
                        }
                    }
                    else
                    {
                        return true;
                    }
                    return false;
                });

            DoSpellCastingWork(text, 0, 0, false, 0, gbl.spell_id);
        }
Пример #34
0
        public SpellWhen whenCast; //seg600:37E7 unk_19AF7

        #endregion Fields

        #region Constructors

        public SpellEntry(int spell_idx, SpellClass _spellClass, sbyte _spellLevel,
            int _fixedRange, int _perLvlRange,
            int _fixedDuration, byte _perLvlDuration,
            byte f6, SpellTargets _targets,
            DamageOnSave _damageOnSave, SaveVerseType _saveVerse,
            Affects _affectId, SpellWhen _whenCast,
            int _castingDelay, int _priority, byte fe, byte ff)
        {
            spellClass = _spellClass;
            spellLevel = _spellLevel;
            fixedRange = _fixedRange;
            perLvlRange = _perLvlRange;
            fixedDuration = _fixedDuration;
            perLvlDuration = _perLvlDuration;
            field_6 = f6;
            targetType = _targets;
            damageOnSave = _damageOnSave;
            saveVerse = _saveVerse;
            affect_id = _affectId;
            whenCast = _whenCast;
            castingDelay = _castingDelay;
            priority = _priority;
            field_E = fe;
            field_F = ff;
            spellIdx = spell_idx;
        }
Пример #35
0
 public static void RegisterEffect <TComponent1, TComponent2>(this IEffectApi @this, IEffectSystem system, IEffectRenderer renderer, Affects affects)
 {
     @this.RegisterEffect <TComponent1>(system, renderer, affects);
     @this.RegisterEffect <TComponent2>(affects);
 }