Пример #1
0
    //////////////////////////////////////////
    /// OnQueuedAbility()
    /// Callback for when the monster AI queues
    /// an ability, for this view to update the
    /// visual queue.
    //////////////////////////////////////////
    private void OnQueuedAbility( AbilityData i_dataAbility, bool i_bLoading ) {
        // if this ability is being loading into the view...
        if ( i_bLoading ) {
            // first see if any ability views are unset. If they aren't, init them with this ability.
            foreach ( AbilityView view in AbilityViews ) {
                if ( view.IsSet() == false ) {
                    view.Init( i_dataAbility );
                    return;
                }
            }

            // if the view is "full" of abilities, stick this ability in an overflow queue
            m_queueOverflow.Enqueue( i_dataAbility );
        }
        else {
            // else this ability is being queued in the middle of battle...

            // first enqueue the new abilities
            m_queueOverflow.Enqueue( i_dataAbility );

            // then bump all the abilities down one view
            for ( int i = 0; i < AbilityViews.Count - 1; ++i ) {
                AbilityData dataNext = AbilityViews[i + 1].GetAbilityData();
                AbilityViews[i].Init( dataNext );
            }

            // init the backmost ability with whatever was next from the overflow queue
            AbilityData dataNextAbility = m_queueOverflow.Dequeue();
            AbilityViews[AbilityViews.Count - 1].Init( dataNextAbility );
        }
    }
Пример #2
0
 public static int GetNetworkValue(AbilityData a)
 {
     if(roleAbilities.Contains(a))
         return roleAbilities.IndexOf(a);
     else
         return roleAbilities.Count + moveAbilities.IndexOf(a);
 }
Пример #3
0
    //////////////////////////////////////////
    /// Init()
    /// Inits this UI with the incoming
    /// ability data.
    //////////////////////////////////////////
    public override void Init( AbilityData i_data ) {
        base.Init( i_data );

        // cache some parts of the view
        m_goElements = gameObject.FindInChildren( "Elements" );
        m_fDefaultPreferredHeight = gameObject.GetComponent<LayoutElement>().preferredHeight;

        // listen for messages
        ListenForMessages( true );

        // add this ability's description as a tooltip
        AddTooltip( i_data );        

        // loop through all the required colors of an ability and set the tile to that color
        // this isn't exactly safe, but I'll make sure # of colors < # of tiles for now
        for ( int i = 0; i < CostTiles.Count; ++i ) {
            // the image on the UI
            Image image = CostTiles[i];

            if ( i < m_dataAbility.RequiredColors.Count ) {
                // get the color for this part of the ability
                AbilityColors eColor = m_dataAbility.RequiredColors[i];
                Color color = GameBoard_Chain.Instance.GetAbilityColor( eColor );

                // set the image to whatever color the ability uses
                image.color = color;
            }
            else {               
                // destroy the image; it's not necessary
                Destroy( image.gameObject );
            }
        }
    }
Пример #4
0
    private void QueueActionWithCharacter( AbilityData i_dataAbility, DefaultModel i_model ) {
        // create the queued action and add it to our queue
        QueuedAction action = new QueuedAction( i_model, i_dataAbility );
        m_queueActions.Enqueue( action );

       // Debug.Log( i_dataCharacter.Name + " is queuing " + i_dataAbility.Name );
    }
Пример #5
0
    //////////////////////////////////////////
    /// Init()
    /// Inits this UI with the incoming
    /// ability data.
    //////////////////////////////////////////
    public virtual void Init( AbilityData i_data ) {
        m_dataAbility = i_data;
        
        // set labels
        Name.text = i_data.Name;

        if ( Desc )
            Desc.text = i_data.Desc;
    }
Пример #6
0
    //////////////////////////////////////////
    /// Init()
    /// Inits this UI with the incoming
    /// ability data.
    //////////////////////////////////////////
    public override void Init(AbilityData i_data) {
        base.Init( i_data );

        // set the color of the cost tiles and destroy unnecessary cost tiles
        float fStartingAlpha = Constants.GetConstant<float>( "AbilityCost_No" );
        Color color = Gameboard_Draft.Instance.GetAbilityColor( i_data.RequiredColor );
        color.a = fStartingAlpha;

        for ( int i = 0; i < CostTiles.Count; ++i ) { 
            // set the image to whatever color the ability uses
            Image image = CostTiles[i];
            image.color = color;

            // destroy the image if we don't need it (i.e. cost of ability is lower than index)
            if ( i >= i_data.Cost )
                Destroy( image.gameObject );
        }
    }
Пример #7
0
    private static void ParseModifierStates(JsonData json, AbilityData abilityData, ModifierData modifier)
    {
        var stateDataConfig = GetJsonValue(json, "States");

        if (stateDataConfig != null)
        {
            var modifierStates = new List <ModifierState>();
            foreach (var stateName in stateDataConfig.Keys)
            {
                var stateEnum = GetEnumValue <ModifierStates>(stateName.ToString());
                if (stateEnum == default)
                {
                    BattleLog.LogError("技能[{0}]中有未定义的ModifierStates类型[{1}]", abilityData.configFileName, stateName);
                }
                else
                {
                    var stateValue = GetIntValue(stateDataConfig, stateName);
                    // todo 解析数值
                    //modifierStates.Add();
                }
            }
            modifier.States = modifierStates;
        }
    }
Пример #8
0
    private static List <D2Action> ParseActions(JsonData json, AbilityData abilityData)
    {
        if (json == null)
        {
            return(null);
        }

        var actions = new List <D2Action>();

        foreach (string key in json.Keys)
        {
            Func <JsonData, ActionTarget, AbilityData, D2Action> createMethodName;
            if (AbilityActionCreateMap.TryGetValue(key, out createMethodName))
            {
                var actionJsonData = GetJsonValue(json, key);
                var targetJsonData = GetJsonValue(actionJsonData, "Target");
                var actionTarget   = ParseActionTarget(targetJsonData, abilityData);
                var d2Action       = createMethodName(actionJsonData, actionTarget, abilityData);
                actions.Add(d2Action);
            }
        }

        return(actions);
    }
Пример #9
0
        private IEnumerator Targeting(AbilityData data, PlayerController playerController, Action finished)
        {
            playerController.enabled = false;
            if (targetingPrefabInstance == null)
            {
                targetingPrefabInstance = Instantiate(targetingPrefab);
            }
            else
            {
                targetingPrefabInstance.gameObject.SetActive(true);
            }
            targetingPrefabInstance.localScale = new Vector3(areaAffectRadius * 2, 1, areaAffectRadius * 2);
            while (!data.IsCancelled())
            {
                Cursor.SetCursor(cursorTexture, cursorHotspot, CursorMode.Auto);
                RaycastHit raycastHit;
                if (Physics.Raycast(PlayerController.GetMouseRay(), out raycastHit, 1000, layerMask))
                {
                    targetingPrefabInstance.position = raycastHit.point;

                    if (Input.GetMouseButtonDown(0))
                    {
                        // Absorb the whole mouse click
                        yield return(new WaitWhile(() => Input.GetMouseButton(0)));

                        data.SetTargetedPoint(raycastHit.point);
                        data.SetTargets(GetGameObjectsInRadius(raycastHit.point));
                        break;
                    }
                }
                yield return(null);
            }
            targetingPrefabInstance.gameObject.SetActive(false);
            playerController.enabled = true;
            finished();
        }
Пример #10
0
        public override void Apply(AbilityExecutionContext context, TargetWrapper target)
        {
            UnitDescriptor unit       = context.MaybeOwner.Descriptor;
            AbilityData    spell      = context.Ability.ParamSpellSlot.Spell;
            Spellbook      spellbook  = context.Ability.ParamSpellbook;
            int            spellLevel = context.Ability.ParamSpellLevel.Value;

            if (spellLevel < 1 || spellLevel > spellbook.MaxSpellLevel)
            {
                return;
            }
            foreach (var slot in spellbook.GetMemorizedSpells(spellLevel))
            {
                if (slot.Spell == spell)
                {
                    spellbook.ForgetMemorized(slot);
                }
            }
            unit.AddBuff(flagBuff, unit.Unit);
            UnityModManager.Logger.Log("Rua1?");
            FastStudy.RefreshSubAbls(spellbook, spellLevel);
            UnityModManager.Logger.Log("Rua1?>");
            FastStudy.AddMasterAbls(unit);
        }
        static void Postfix(AbilityData __instance, ref bool __result)
        {
            if (__result == true)
            {
                var standard_action_use = __instance.Caster.Get <UnitPartStandardActionAbilityUse>();
                if (standard_action_use != null)
                {
                    __result = !standard_action_use.canBeUsedOnAbility(__instance, CommandType.Standard);
                }
                return;
            }

            var full_round_use_part = __instance.Caster.Get <UnitPartFullRoundAbilityUse>();

            if (full_round_use_part == null)
            {
                return;
            }

            if (full_round_use_part.canBeUsedOnAbility(__instance))
            {
                __result = true;
            }
        }
Пример #12
0
    public void UpgradeAbility(int index)
    {
        if (UseMoney(AbilityController.instance.GetCurrentAbilityCost(index)))
        {
            AbilityController.instance.RenewAbilityData(index, 1);
            AbilityData RenewedAbility = AbilityController.instance.GetData(index);
            LobbyUIController.instance.RenewAbilityData(index, ref RenewedAbility);
            switch (RenewedAbility.type)
            {
            case eAbilityTypes.HP:
                LobbyUIController.instance.SetHP(RenewedAbility.currentAbilityEffect);
                break;

            case eAbilityTypes.AP:
                break;

            default:
                break;
            }
        }
        else
        {
        }
    }
            public override bool CanBeUsedOn(BlueprintAbility ability, [CanBeNull] AbilityData data)
            {
                bool is_metamagic_not_available = ability == null || data?.Spellbook == null || ability.Type != AbilityType.Spell ||
                                                  ((ability.AvailableMetamagic & Metamagic) == 0);

                if (is_metamagic_not_available)
                {
                    return(false);
                }

                if (!spell_descriptor.HasAnyFlag(data.Blueprint.SpellDescriptor) && spell_descriptor != SpellDescriptor.None)
                {
                    return(false);
                }

                int cost = calculate_cost(this.Owner.Unit);

                if (resource != null && this.Owner.Resources.GetResourceAmount((BlueprintScriptableObject)this.resource) < cost)
                {
                    return(false);
                }

                return(true);
            }
        static public bool Prefix(AbilityData __instance, ref bool __result)
        {
            bool result;

            if (__instance.ActionType == UnitCommand.CommandType.Standard)
            {
                Spellbook spellbook            = __instance.Spellbook;
                bool?     isSpontaneous        = (spellbook != null) ? new bool?(spellbook.Blueprint.Spontaneous) : null;
                bool?     isArcanist           = (spellbook != null) ? new bool?(spellbook.Blueprint.CharacterClass == ArcanistClass.arcanist) : null;
                bool?     isUsingSponMetamagic = (spellbook != null) ? new bool?(spellbook.Owner.HasFact(SponMetamagic.flagBuff)) : null;
                //UnityModManager.Logger.Log($"spontaneous  = {(isSpontaneous!=null ? (isSpontaneous.Value?"T":"F") : "null")}");
                //UnityModManager.Logger.Log($"arcanist  = {(isArcanist != null ? (isArcanist.Value ? "T" : "F") : "null")}");
                //UnityModManager.Logger.Log($"sponmeta  = {(isUsingSponMetamagic != null ? (isUsingSponMetamagic.Value ? "T" : "F") : "null")}");
                if (isSpontaneous != null && isSpontaneous.Value)
                {
                    MetamagicData metamagicData = __instance.MetamagicData;
                    bool?         flag2         = (metamagicData != null) ? new bool?(metamagicData.NotEmpty) : null;
                    if (flag2 != null && flag2.Value)
                    {
                        __result = !(isArcanist.Value && !(isUsingSponMetamagic.Value));
                        if (isUsingSponMetamagic.Value)
                        {
                            spellbook.Owner.RemoveFact(SponMetamagic.flagBuff);
                        }
                        return(false);
                    }
                }
                __result = __instance.Blueprint.IsFullRoundAction;
                return(false);
            }
            else
            {
                __result = false;
                return(false);
            }
        }
Пример #15
0
        static public bool Prefix(ActionBarGroupElement __instance, ref UnitEntityData ___m_Selected, ref ActionBarSubGroupLevels ___m_Levels)
        {
            if (!__instance.PreInit)
            {
                __instance.Dispose();
            }
            int index = 0;
            ActionBarSlotType slotType = __instance.SlotType;

            if (slotType != ActionBarSlotType.Spell)
            {
                /*
                 * if (slotType != ActionBarSlotType.Item) {
                 *  if (slotType == ActionBarSlotType.ActivatableAbility) {
                 *      foreach (Ability ability in ___m_Selected.Abilities) {
                 *          if (!ability.Hidden && !ability.Blueprint.IsCantrip) {
                 *              ActionBarGroupSlot slot = __instance.GetSlot(index++);
                 *              slot.Set(___m_Selected, new MechanicActionBarSlotAbility {
                 *                  Ability = ability.Data,
                 *                  Unit = ___m_Selected
                 *              });
                 *          }
                 *      }
                 *      foreach (ActivatableAbility activatableAbility in ___m_Selected.ActivatableAbilities) {
                 *          ActionBarGroupSlot slot2 = __instance.GetSlot(index++);
                 *          slot2.Set(___m_Selected, new MechanicActionBarSlotActivableAbility {
                 *              ActivatableAbility = activatableAbility,
                 *              Unit = ___m_Selected
                 *          });
                 *      }
                 *  }
                 * }
                 * else {
                 *  foreach (UsableSlot usableSlot in ___m_Selected.Body.QuickSlots) {
                 *      ActionBarGroupSlot slot3 = __instance.GetSlot(index++);
                 *      if (usableSlot.HasItem) {
                 *          slot3.Set(___m_Selected, new MechanicActionBarSlotItem {
                 *              Item = usableSlot.Item,
                 *              Unit = ___m_Selected
                 *          });
                 *      }
                 *      else {
                 *          slot3.Set(___m_Selected, new MechanicActionBarSlotEmpty());
                 *      }
                 *  }
                 * }
                 * __instance.AddEmptySlots(index);
                 * return;
                 */
                return(true);
            }
            if (___m_Levels != null)
            {
                ___m_Levels.Clear();
            }
            List <AbilityData> list = new List <AbilityData>();

            foreach (Ability ability2 in ___m_Selected.Abilities)
            {
                if (!ability2.Hidden && ability2.Blueprint.IsCantrip)
                {
                    AbilityData data = ability2.Data;
                    if (!list.Contains(data))
                    {
                        list.Add(data);
                        if (___m_Levels != null)
                        {
                            ___m_Levels.AddSlot(0, new MechanicActionBarSlotAbility {
                                Ability = data,
                                Unit    = ___m_Selected
                            });
                        }
                    }
                }
            }
            foreach (Spellbook spellbook in ___m_Selected.Descriptor.Spellbooks)
            {
                if (spellbook.Blueprint.Spontaneous)
                {
                    if (spellbook.Blueprint.CharacterClass == Main.arcanist)
                    {
                        for (int i = 1; i <= spellbook.MaxSpellLevel; i++)
                        {
                            IEnumerable <SpellSlot> memorizedSpells = spellbook.GetMemorizedSpells(i);
                            foreach (SpellSlot spellSlot in memorizedSpells)
                            {
                                if (!spellSlot.Available)
                                {
                                    continue;
                                }
                                AbilityData abilityData = spellSlot.Spell;
                                abilityData.ParamSpellSlot = spellSlot;
                                if (!list.Contains(abilityData))
                                {
                                    list.Add(abilityData);
                                    if (___m_Levels != null)
                                    {
                                        ___m_Levels.AddSlot(i, new MechanicActionBarSlotSpontaneusSpell {
                                            Spell = abilityData,
                                            Unit  = ___m_Selected
                                        });
                                    }
                                }
                            }
                        }
                    }

                    else
                    {
                        for (int i = 1; i <= spellbook.MaxSpellLevel; i++)
                        {
                            List <AbilityData> list2      = spellbook.GetSpecialSpells(i).Concat(spellbook.GetKnownSpells(i)).Distinct <AbilityData>().ToList <AbilityData>();
                            List <AbilityData> collection = spellbook.GetCustomSpells(i).ToList <AbilityData>();
                            List <AbilityData> list3      = list2;
                            list3.AddRange(collection);
                            foreach (AbilityData abilityData in list3)
                            {
                                if (!list.Contains(abilityData))
                                {
                                    list.Add(abilityData);
                                    if (___m_Levels != null)
                                    {
                                        ___m_Levels.AddSlot(i, new MechanicActionBarSlotSpontaneusSpell {
                                            Spell = abilityData,
                                            Unit  = ___m_Selected
                                        });
                                    }
                                }
                            }
                        }
                    }
                }
                else
                {
                    //Added codes start. Arcanist use their memorized spells as known spells.
                    if (1 == 0 /*spellbook.Blueprint.CharacterClass == Main.arcanist*/)
                    {
                        UnityModManager.Logger.Log("Rua spellbook is arcanist!");
                        for (int i = 1; i <= spellbook.MaxSpellLevel; i++)
                        {
                            IEnumerable <SpellSlot> memorizedSpells = spellbook.GetMemorizedSpells(i);
                            foreach (SpellSlot spellSlot in memorizedSpells)
                            {
                                if (!spellSlot.Available)
                                {
                                    continue;
                                }
                                AbilityData abilityData = spellSlot.Spell;
                                if (!list.Contains(abilityData))
                                {
                                    list.Add(abilityData);
                                    if (___m_Levels != null)
                                    {
                                        ___m_Levels.AddSlot(i, new MechanicActionBarSlotSpontaneusSpell {
                                            Spell = abilityData,
                                            Unit  = ___m_Selected
                                        });
                                    }
                                }
                            }
                        }
                    }
                    //Added codes end.
                    else
                    {
                        for (int j = 0; j <= spellbook.MaxSpellLevel; j++)
                        {
                            IEnumerable <SpellSlot> memorizedSpells = spellbook.GetMemorizedSpells(j);
                            foreach (SpellSlot spellSlot in memorizedSpells)
                            {
                                if (!list.Contains(spellSlot.Spell))
                                {
                                    list.Add(spellSlot.Spell);
                                    if (___m_Levels != null)
                                    {
                                        ___m_Levels.AddSlot(j, new MechanicActionBarSlotMemorizedSpell {
                                            SpellSlot = spellSlot,
                                            Unit      = ___m_Selected
                                        });
                                    }
                                }
                            }
                        }
                    }
                }
            }
            if (___m_Levels != null)
            {
                ___m_Levels.SetType(__instance.SlotType);
            }
            return(false);
        }
Пример #16
0
 public AdjacentUnitsGetHeavyAbility(Enumerators.CardKind cardKind, AbilityData ability)
     : base(cardKind, ability)
 {
 }
 public void getStoredSpell(out AbilityData stored_spell)
 {
     stored_spell = spell;
 }
            public void refreshSpellLevel(int level)
            {
                var active_spellbook = this.Owner.GetSpellbook(spellbook);

                if (active_spellbook == null)
                {
                    return;
                }

                var memorization_spellbook_blueprint = active_spellbook.Blueprint.GetComponent <SpellbookMechanics.GetKnownSpellsFromMemorizationSpellbook>()?.spellbook;

                if (memorization_spellbook_blueprint == null)
                {
                    return;
                }
                var memorization_spellbook = this.Owner.Spellbooks.Where(s => s.Blueprint == memorization_spellbook_blueprint).FirstOrDefault();

                if (memorization_spellbook == null)
                {
                    return;
                }

                var m_KnownSpells  = Helpers.GetField <List <AbilityData>[]>(active_spellbook, "m_KnownSpells");
                var m_customSpells = Helpers.GetField <List <AbilityData>[]>(active_spellbook, "m_CustomSpells");
                Dictionary <BlueprintAbility, int> m_KnownSpellLevels = Helpers.GetField <Dictionary <BlueprintAbility, int> >(active_spellbook, "m_KnownSpellLevels");
                var m_MemorizedSpells = Helpers.GetField <List <SpellSlot>[]>(memorization_spellbook, "m_MemorizedSpells");

                foreach (var known_spell in active_spellbook.GetKnownSpells(level).ToArray())
                {
                    m_KnownSpells[level].Remove(known_spell);
                    remove(known_spell.Blueprint, known_spell.MetamagicData?.MetamagicMask ?? (Metamagic)0);
                    EventBus.RaiseEvent <ISpellBookCustomSpell>((Action <ISpellBookCustomSpell>)(h => h.RemoveSpellHandler(known_spell)));
                    if (!prepared_spells_with_metamagic.ContainsKey(known_spell.Blueprint.AssetGuid))
                    {
                        m_KnownSpellLevels.Remove(known_spell.Blueprint);
                    }
                }

                foreach (var slot in m_MemorizedSpells[level].ToArray())
                {
                    if (slot.Spell != null)
                    {
                        var new_ability = new AbilityData(slot.Spell.Blueprint, active_spellbook);
                        if (slot.Spell.MetamagicData != null)
                        {
                            new_ability.MetamagicData = slot.Spell.MetamagicData.Clone();
                            this.add(new_ability.Blueprint, new_ability.MetamagicData.MetamagicMask);
                        }
                        else
                        {
                            this.add(new_ability.Blueprint, (Metamagic)0);
                        }
                        var spell_level = memorization_spellbook.GetSpellLevel(slot.Spell.Blueprint);
                        new_ability.DecorationBorderNumber = slot.Spell.DecorationBorderNumber;
                        new_ability.DecorationColorNumber  = slot.Spell.DecorationColorNumber;

                        m_KnownSpells[slot.Spell.SpellLevel].Add(new_ability);
                        m_KnownSpellLevels[slot.Spell.Blueprint] = spell_level;
                        EventBus.RaiseEvent <ISpellBookCustomSpell>((Action <ISpellBookCustomSpell>)(h => h.AddSpellHandler(new_ability)));
                    }
                }


                for (int lvl = 0; lvl <= 9; lvl++)
                {
                    foreach (var s in m_customSpells[lvl].ToArray())
                    {
                        if (!authorisedMetamagic(s.Blueprint, s.MetamagicData?.MetamagicMask ?? (Metamagic)0))
                        {
                            m_customSpells[lvl].Remove(s);
                            EventBus.RaiseEvent <ISpellBookCustomSpell>((Action <ISpellBookCustomSpell>)(h => h.RemoveSpellHandler(s)));
                        }
                    }
                }
            }
            static bool Prefix(ActionBarGroupSlot __instance, ref List <AbilityData> ___Conversion, ref ButtonPF ___ToggleAdditionalSpells, AbilityData spell)
            {
                Spellbook spellBook = spell.Spellbook;

                if (spellBook == null)
                {
                    return(false);
                }
                ___Conversion = spellBook.GetSpontaneousConversionSpells(spell).EmptyIfNull <BlueprintAbility>().Select <BlueprintAbility, AbilityData>((Func <BlueprintAbility, AbilityData>)(b => new AbilityData(b, spellBook)
                {
                    ConvertedFrom = spell
                })).ToList <AbilityData>();
                SpellSlot spellSlot = (__instance.MechanicSlot as MechanicActionBarSlotMemorizedSpell)?.SpellSlot;

                if (spellSlot != null)
                {
                    foreach (Ability ability in spell.Caster.Abilities)
                    {
                        if (ability.Blueprint.GetComponent <AbilityRestoreSpellSlot>() != null)
                        {
                            ___Conversion.Add(new AbilityData(ability)
                            {
                                ParamSpellSlot = spellSlot
                            });
                        }

                        var store_spell = ability.Blueprint.GetComponent <AbilityConvertSpell>();
                        if (store_spell != null && store_spell.canBeUsedOn(spell))
                        {
                            ___Conversion.Add(new AbilityData(ability)
                            {
                                ParamSpellSlot = spellSlot
                            });
                        }
                    }
                }
                AbilityData paramSpell = (__instance.MechanicSlot as MechanicActionBarSlotSpontaneusSpell)?.Spell;

                if (paramSpell != null)
                {
                    SpellSlot paramSpellSlot = new SpellSlot(paramSpell.SpellLevel, SpellSlotType.Common, 0); //create fake slot for AbilityConvertSpell
                    paramSpellSlot.Spell = paramSpell;
                    foreach (Ability ability in spell.Caster.Abilities)
                    {
                        if (ability.Blueprint.GetComponent <AbilityRestoreSpontaneousSpell>() != null) //try with spontnaeous convert spell
                        {
                            ___Conversion.Add(new AbilityData(ability)
                            {
                                ParamSpellbook  = paramSpell.Spellbook,
                                ParamSpellLevel = new int?(paramSpell.SpellLevel)
                            });
                        }

                        var store_spell = ability.Blueprint.GetComponent <AbilityConvertSpell>();
                        if (store_spell != null && store_spell.canBeUsedOn(spell))
                        {
                            ___Conversion.Add(new AbilityData(ability)
                            {
                                ParamSpellSlot = paramSpellSlot
                            });
                        }
                    }
                }
                BlueprintAbility spellBlueprint = spell.Blueprint;

                if (!___Conversion.Any <AbilityData>((Func <AbilityData, bool>)(s => s.Blueprint != spellBlueprint)) && (spellBlueprint.Variants == null || !(spellBlueprint.Variants).Any <BlueprintAbility>()) || ___ToggleAdditionalSpells == null)
                {
                    return(false);
                }
                ___ToggleAdditionalSpells.gameObject.SetActive(true);
                return(false);
            }
 public void HandleKineticistAcceptBurn(UnitPartKineticist kinetecist, int burn, AbilityData ability)
 {
     if (actions != null)
     {
         (this.Fact as IFactContextOwner)?.RunActionInContext(this.actions, kinetecist.Owner.Unit);
     }
 }
Пример #21
0
 protected override void initFromSaveData(AbilityData savedata)
 {
     base.initFromSaveData(savedata);
     TargetElemental = (CharacterParameterBasis.Elemental)Enum.Parse(typeof(CharacterParameterBasis.Elemental), savedata.AbilityParameter[0]);
 }
Пример #22
0
    //////////////////////////////////////////
    /// AddTooltip()
    /// Adds a tooltip to this ability view
    /// using the ability's description.
    //////////////////////////////////////////
    private void AddTooltip( AbilityData i_data ) {
        TooltipTrigger tooltipTrigger = gameObject.AddComponent<TooltipTrigger>();
        TooltipStyle tooltipStyle = Resources.Load<TooltipStyle>( "CleanSimple" );
        tooltipTrigger.tooltipStyle = tooltipStyle;

        // Set the tooltip text.
        tooltipTrigger.SetText( "BodyText", i_data.Desc );

        // Set some extra style properties on the tooltip
        tooltipTrigger.maxTextWidth = 250;
        tooltipTrigger.backgroundTint = Color.white;
        tooltipTrigger.tipPosition = TipPosition.TopRightCorner;
    }
Пример #23
0
        public AbilityEvent(BitReader bitReader, Replay replay, Player player, AbilityData abilityData, UnitData unitData)
        {
            uint flags;
            //   1.3.3 patch notes:
            //   - Fixed an issue where the APM statistic could be artificially increased.
            // This adds the "failed" flag, which is triggered usually by holding down a
            // hotkey, leading to key repeat spamming the event throughout a single tick.
            if (replay.ReplayBuild < 18574) // < 1.3.3
            {
                flags = bitReader.Read(17);
            }
            else if (replay.ReplayBuild < 22612) // < 1.5.0
            {
                flags = bitReader.Read(18);
            }
            else
            {
                flags = bitReader.Read(20);
            }
            Queued = (flags & 2) != 0;
            RightClick = (flags & 8) != 0;
            WireframeClick = (flags & 0x20) != 0;
            ToggleAbility = (flags & 0x40) != 0;
            EnableAutoCast = (flags & 0x80) != 0;
            AbilityUsed = (flags & 0x100) != 0;
            WireframeUnload = (flags & 0x200) != 0;
            WireframeCancel = (flags & 0x400) != 0;
            MinimapClick = (flags & 0x10000) != 0;
            AbilityFailed = (flags & 0x20000) != 0;

            // flags & 0xf815 -> Debug for unknown flags
            // Never found any across all test data.

            DefaultAbility = (bitReader.Read(1) == 0);
            DefaultActor = true;
            if (!DefaultAbility)
            {
                AbilityType = abilityData.GetAbilityType(
                    (int)bitReader.Read(16),
                    (int)bitReader.Read(5));
                DefaultActor = (bitReader.Read(1) == 0);
                if (!DefaultActor)
                {   // I'm thinking this would be an array type... but I can't
                    // find anything that causes this bit to be set.
                    throw new InvalidOperationException("Unsupported: non-default actor");
                }
            }
            if (DefaultActor)
            {
                // Deep copy the current wireframe as the actor list
                // -----
                // If a user wants to deal with subgroups to get a more
                // concise actor list, the data is all here.  We're not
                // going to bother, though, because there are several
                // exceptions to account for in determining event actors.
                Actors = new List<Unit>(player.Wireframe.Count);
                foreach (var unit in player.Wireframe)
                {
                    Actors.Add(new Unit(unit));
                }
            }

            var targetType = bitReader.Read(2);
            if (targetType == 1) // Location target
            {
                var targetX = bitReader.Read(20);
                var targetY = bitReader.Read(20);
                var targetZ = bitReader.Read(32);
                TargetLocation = Location.FromEventFormat(targetX, targetY, targetZ);
            }
            else if (targetType == 2) // Unit + Location target
            {
                TargetFlags = (int)bitReader.Read(8);
                WireframeIndex = (int)bitReader.Read(8);

                var unitId = (int)bitReader.Read(32);
                var unit = replay.GetUnitById(unitId);
                var unitTypeId = (int)bitReader.Read(16);
                if (unit == null)
                {
                    var unitType = unitData.GetUnitType(unitTypeId);
                    unit = new Unit(unitId, unitType);
                    unit.typeId = unitTypeId;
                    replay.GameUnits.Add(unitId, unit);
                }

                TargetUnit = unit;

                var targetHasPlayer = bitReader.Read(1) == 1;
                if (targetHasPlayer)
                {
                    TargetPlayer = (int)bitReader.Read(4);
                }

                // 1.4.0 -- Don't really know what this was meant to fix
                if (replay.ReplayBuild >= 19595)
                {
                    var targetHasTeam = bitReader.Read(1) == 1;
                    if (targetHasTeam)
                    {
                        TargetTeam = (int)bitReader.Read(4);
                    }
                }

                var targetX = bitReader.Read(20);
                var targetY = bitReader.Read(20);
                var targetZ = bitReader.Read(32);
                TargetLocation = Location.FromEventFormat(targetX, targetY, targetZ);
            }
            else if (targetType == 3) // Unit target
            {
                var id = bitReader.Read(32);
                // Again, if the user wants to determine exactly which
                // queue item is canceled in the case of a queue cancel
                // event (the most common case of this target specifier's
                // occurence), they can; however, it requires an additional
                // data structure that I don't want to bother with; however,
                // all the underlying data is available in the events list.
                TargetId = id;
            }

            var lastBit = bitReader.Read(1); // Should be 0; if not, misalignment is likely

            if (!AbilityFailed)
            {
                if (RightClick)
                {
                    this.EventType = GameEventType.RightClick;
                }
                else
                {
                    this.EventType = EventData.GetInstance().GetEventType(this.AbilityType);
                }
            }
            else
            {
                this.EventType = GameEventType.Inactive;
            }
        }
Пример #24
0
 protected override void initFromSaveData(AbilityData savedata)
 {
     base.initFromSaveData(savedata);
     ExertionCount = int.Parse(savedata.AbilityParameter[0]);
     CurrentFailureRate = calcFailureRate()+0.001f;
 }
Пример #25
0
 protected virtual void initFromSaveData(AbilityData savedata)
 {
     CurrentAbilityLevel = savedata.AbilityLevel;
 }
Пример #26
0
 static bool CanNotTarget(AbilityData ability, TargetWrapper target)
 {
     return(Mod.Enabled && target.Unit != null &&
            ((FixAbilityCanTargetUntargetableUnit && target.Unit.Descriptor.State.IsUntargetable) ||
             (FixAbilityCanTargetDeadUnit && target.Unit.Descriptor.State.IsDead && !ability.Blueprint.CanCastToDeadTarget)));
 }
Пример #27
0
 public static double GetAbilityValue(Ability ability, AbilityData data, uint level = 0xABADC0DE)
 {
     if (data == null) return 0.0;
     if (level == 0xABADC0DE) level = ability.Level - 1;
     if (level > 0xF0000000) level = 0;
     return data.Count > 1 ? data.GetValue(level) : data.Value;
 }
Пример #28
0
 protected void ClassAbility(string name, string actionID, TimeSpan delay, TimeSpan cooldown, string desc = "No description available.", int level = 1, int spCost = 0, int hpCost = 0)
 {
     AbilityData newAbility = new AbilityData();
     newAbility.name = name;
     newAbility.actionID = actionID;
     newAbility.description = desc;
     newAbility.delay = delay;
     newAbility.coolDown = cooldown;
     newAbility.level = level;
     newAbility.spCost = spCost;
     newAbility.hpCost = hpCost;
     abilityList.Add(newAbility);
 }
Пример #29
0
 //////////////////////////////////////////
 /// Init()
 /// Inits this UI with the incoming
 /// ability data.
 //////////////////////////////////////////
 public override void Init( AbilityData i_data ) {
     base.Init( i_data );
 }
Пример #30
0
 public QueuedAction( DefaultModel i_char, AbilityData i_ability ) {
     m_strCharacterID = i_char.GetPropertyValue<string>( "Name" );
     m_dataAbility = i_ability;
 }
Пример #31
0
 public virtual void ApplyCharacterUpgrade(CharacterUpgrade characterUpgrade)
 {
     Roost.Debug.Assert(characterUpgrade != null);
     Roost.Debug.Assert(!this.HasAppliedCharacterUpgrade(characterUpgrade));
     base.Stats.AddMaxHealth(characterUpgrade.ExtraHealth);
     base.Stats.AddMaxSpecial(characterUpgrade.ExtraSpecial);
     if (characterUpgrade.IsShieldRechargeUpgrade)
     {
         base.Stats.m_stats.ShieldDepletedTimeSeconds = characterUpgrade.ShieldDepletedTimeSeconds;
         base.Stats.m_stats.ShieldRechargeTimeSeconds = characterUpgrade.ShieldRechargeTimeSeconds;
     }
     if (characterUpgrade.IsMaxShieldUpgrade)
     {
         base.Stats.SetMaxShield(characterUpgrade.MaxShield);
         base.Stats.m_stats.ShieldBarWidth = characterUpgrade.ShieldBarWidth;
     }
     if (characterUpgrade.IsHitsPerSpecialUpgrade)
     {
         base.Stats.m_stats.hitsPerSpecialAward = characterUpgrade.HitsPerSpecial;
     }
     if (characterUpgrade.IsSpecialProgressForHitStreakUpgrade)
     {
         base.Stats.m_stats.specialProgressForHitStreak = characterUpgrade.SpecialProgressForHitStreak;
     }
     if (characterUpgrade.IsHitchainResilianceUpgrade)
     {
         base.Stats.m_stats.hitchainResilaince   = characterUpgrade.HitchainResiliance;
         base.Stats.m_stats.hitchainResetSeconds = characterUpgrade.HitchainResetSeconds;
     }
     if (characterUpgrade.IsSecondWindUpgrade)
     {
         base.Stats.m_stats.hasSecondWind = true;
         base.Stats.m_stats.secondWindSpecialPercentage = characterUpgrade.SecondWindSpecialPercentage;
         base.Stats.m_stats.secondWindCooldownSeconds   = characterUpgrade.SecondWindCooldownSeconds;
     }
     if (characterUpgrade.IsReviveTimeUpgrade)
     {
         base.Stats.m_stats.TotalReviveTimeSeconds = characterUpgrade.TotalReviveTimeSeconds;
     }
     FieldInfo[] array = (
         from field in characterUpgrade.UpgradedPlayerAbilities.GetType().GetFields(BindingFlags.Instance | BindingFlags.Public)
         where field.GetValue(characterUpgrade.UpgradedPlayerAbilities) != null
         select field).ToArray <FieldInfo>();
     FieldInfo[] fieldInfoArray = array;
     for (int i = 0; i < (int)fieldInfoArray.Length; i++)
     {
         FieldInfo fieldInfo = fieldInfoArray[i];
         if (!fieldInfo.FieldType.IsArray)
         {
             fieldInfo.SetValue(this.m_playerAbilities, fieldInfo.GetValue(characterUpgrade.UpgradedPlayerAbilities));
         }
         else
         {
             AbilityData[] value            = fieldInfo.GetValue(this.m_playerAbilities) as AbilityData[];
             AbilityData[] abilityDataArray = fieldInfo.GetValue(characterUpgrade.UpgradedPlayerAbilities) as AbilityData[];
             if ((int)abilityDataArray.Length != 0)
             {
                 if (value != null && abilityDataArray != null)
                 {
                     AbilityData[] abilityDataArray1 = new AbilityData[Mathf.Max((int)value.Length, (int)abilityDataArray.Length)];
                     for (int j = 0; j < (int)abilityDataArray1.Length; j++)
                     {
                         if (j >= (int)abilityDataArray.Length || !(abilityDataArray[j] != null))
                         {
                             abilityDataArray1[j] = value[j];
                         }
                         else
                         {
                             abilityDataArray1[j] = abilityDataArray[j];
                         }
                     }
                     fieldInfo.SetValue(this.m_playerAbilities, abilityDataArray1);
                 }
             }
         }
     }
     if (this.event_OnAbilityChange != null)
     {
         this.event_OnAbilityChange();
     }
     this.m_appliedCharacterUpgrades.Add(characterUpgrade);
 }
 public static EquipmentAbilityBasis convertSaveDataToInstance(AbilityData savedata)
 {
     var ret = Activator.CreateInstance(Type.GetType(savedata.Type)) as EquipmentAbilityBasis;
     ret.initFromSaveData(savedata);
     //Debug.Log("Instance:" + ret.ToString());
     return ret;
 }
 static void Postfix(AbilityData __instance, ref float __result)
 {
     AbilityData_GetApproachDistance_Patch.Postfix(__instance, null, ref __result);
 }
            static bool Prefix(DescriptionTemplatesAbility __instance, bool isTooltip, DescriptionBricksBox box, AbilityData abilityData)
            {
                if (abilityData.ParamSpellSlot == null || abilityData.Blueprint.GetComponent <AbilityStoreSpellInFact>() == null)
                {
                    return(true);
                }

                string name = abilityData.Blueprint.Name;
                var    c    = abilityData.Blueprint.GetComponent <AbilityConvertSpell>().getSpellOrVariantBlueprint(abilityData.ParamSpellSlot.Spell.Blueprint);

                if (c != null)
                {
                    name += $" ({c.Name})";
                }

                DescriptionBrick descriptionBrick = DescriptionBuilder.Templates.IconNameHeader(box, name, abilityData.Blueprint.Icon, isTooltip);
                string           text1            = LocalizedTexts.Instance.AbilityTypes.GetText(abilityData.Blueprint.Type);
                string           text2            = abilityData.Blueprint.School == SpellSchool.None ? string.Empty : LocalizedTexts.Instance.SpellSchoolNames.GetText(abilityData.Blueprint.School);
                string           text3            = abilityData.Blueprint.School == SpellSchool.None ? string.Empty : (string)UIStrings.Instance.SpellBookTexts.Level + ": " + (object)abilityData.SpellLevel;

                descriptionBrick.SetText(text1, 1);
                descriptionBrick.SetText(text2, 2);
                if (abilityData.Blueprint.Type != AbilityType.Spell)
                {
                    return(false);
                }
                descriptionBrick.SetText(text3, 3);

                return(false);
            }
Пример #35
0
        public static List <IGameEvent> Parse(Replay replay, byte[] buffer)
        {
            // The GameEvent file changes significantly after 16561.
            // This is sometime around the first patch after release. Since
            // parsing replays this old should be extremely rare, I don't believe
            // its worth the effort to try to support both. If it is, it should be
            // done in another method.
            //
            // Still a bitstream, but stuff's moved around and event codes are different.
            if (replay.ReplayBuild < 16561)
            {
                throw new NotSupportedException(
                          "Replay builds under 16561 are not supported for parsing GameEvent log.");
            }

            // Initialize Ability and Unit data.
            var effectiveBuild = BuildData.GetInstance().GetEffectiveBuild(replay.ReplayBuild);

            if (effectiveBuild == 0)
            {
                throw new NotSupportedException(
                          String.Format("Replay build {0} is not supported by the current event database", replay.ReplayBuild));
            }
            var abilityData = new AbilityData(effectiveBuild);
            var unitData    = new UnitData(effectiveBuild);

            var events = new List <IGameEvent>();

            // Keep a reference to know the game length.
            var ticksElapsed = 0;

            using (var stream = new MemoryStream(buffer))
            {
                var bitReader = new BitReader(stream);

                var playersGone = new bool[0x10];

                while (!bitReader.EndOfStream)
                {
                    var intervalLength = 6 + (bitReader.Read(2) << 3);
                    var interval       = bitReader.Read(intervalLength);
                    ticksElapsed += (int)interval;
                    var    playerIndex = (int)bitReader.Read(5);
                    Player player;
                    if (playerIndex < 0x10)
                    {
                        player = replay.GetPlayerById(playerIndex);
                    }
                    else
                    {
                        player = Player.Global;
                    }

                    var        eventType = bitReader.Read(7);
                    IGameEvent gameEvent;
                    switch (eventType)
                    {
                    case 0x05:     // Game start
                        gameEvent = new GameStartEvent();
                        break;

                    case 0x0b:
                    case 0x0c:     // Join game
                        gameEvent = new PlayerJoinEvent(bitReader, replay, playerIndex);
                        break;

                    case 0x19:     // Leave game
                        gameEvent = new PlayerLeftEvent(player);
                        playersGone[playerIndex] = true;
                        DetectWinners(playersGone, replay);
                        break;

                    case 0x1b:     // Ability
                        gameEvent = new AbilityEvent(bitReader, replay, player, abilityData, unitData);
                        break;

                    case 0x1c:     // Selection
                        gameEvent = new SelectionEvent(bitReader, replay, player, unitData);
                        break;

                    case 0x1d:     // Control groups
                        gameEvent = new HotkeyEvent(bitReader, replay, player);
                        break;

                    case 0x1f:     // Send resources
                        gameEvent = new SendResourcesEvent(bitReader, replay);
                        break;

                    case 0x23:     // ??
                        gameEvent           = new GameEventBase();
                        gameEvent.EventType = GameEventType.Inactive;
                        bitReader.Read(8);
                        break;

                    case 0x26:     // ??
                        gameEvent           = new GameEventBase();
                        gameEvent.EventType = GameEventType.Inactive;
                        bitReader.Read(32);
                        bitReader.Read(32);
                        break;

                    case 0x27:     // Target critter - special
                        gameEvent           = new GameEventBase();
                        gameEvent.EventType = GameEventType.Selection;
                        var unitId = bitReader.Read(32);
                        break;

                    case 0x31:     // Camera
                        gameEvent = new CameraEvent(bitReader, replay);
                        break;

                    case 0x37:     // UI Event
                        gameEvent           = new GameEventBase();
                        gameEvent.EventType = GameEventType.Other;
                        bitReader.Read(32);
                        bitReader.Read(32);
                        break;

                    case 0x38:     // weird sync event
                    {
                        gameEvent           = new GameEventBase();
                        gameEvent.EventType = GameEventType.Other;
                        for (var j = 0; j < 2; j++)
                        {
                            var length = bitReader.Read(8);
                            for (var i = 0; i < length; i++)
                            {
                                bitReader.Read(32);
                            }
                        }
                        break;
                    }

                    case 0x3c:     // ???
                        gameEvent           = new GameEventBase();
                        gameEvent.EventType = GameEventType.Inactive;
                        bitReader.Read(16);
                        break;

                    case 0x46:     // Request resources
                        gameEvent = new RequestResourcesEvent(bitReader, replay);
                        break;

                    case 0x47:     // ?? -- associated with send minerals
                        gameEvent           = new GameEventBase();
                        gameEvent.EventType = GameEventType.Inactive;
                        bitReader.Read(32);
                        break;

                    case 0x48:     // ?? -- sync event
                        gameEvent           = new GameEventBase();
                        gameEvent.EventType = GameEventType.Inactive;
                        bitReader.Read(32);
                        break;

                    case 0x4C:     // ?? -- seen with spectator
                        bitReader.Read(4);
                        gameEvent           = new GameEventBase();
                        gameEvent.EventType = GameEventType.Inactive;
                        break;

                    case 0x59:     // ?? -- sync flags maybe?
                        bitReader.Read(32);
                        gameEvent           = new GameEventBase();
                        gameEvent.EventType = GameEventType.Inactive;
                        break;

                    default:     // debug
                        throw new InvalidOperationException(String.Format(
                                                                "Unknown event type {0:x} at {1:x} in replay.game.events",
                                                                eventType, bitReader.Cursor));
                    }

                    gameEvent.Player = player;
                    gameEvent.Time   = Timestamp.Create(ticksElapsed);
                    events.Add(gameEvent);

                    bitReader.AlignToByte();
                }
            }

            replay.GameLength = Timestamp.Create(ticksElapsed).TimeSpan;

            return(events);
        }
 public void clearSpell()
 {
     spell = null;
 }
Пример #37
0
 protected override void initFromSaveData(AbilityData savedata)
 {
     base.initFromSaveData(savedata);
     HungerSpeed = (PlayerParameter.HungerSpeedType)Enum.Parse(typeof(PlayerParameter.HungerSpeedType),savedata.AbilityParameter[0]);
 }
            public static void storeSpell(UnitDescriptor unit, BlueprintUnitFact fact, AbilityData spell)
            {
                var store_buff = unit.Buffs.GetFact(fact);

                if (store_buff == null)
                {
                    store_buff = unit.Progression.Features.GetFact(fact);
                }
                if (store_buff != null)
                {
                    var sticky_touch = spell.Blueprint.GetComponent <AbilityEffectStickyTouch>();
                    if (sticky_touch != null)
                    {
                        var touch_spell = new AbilityData(spell, sticky_touch.TouchDeliveryAbility);
                        store_buff.CallComponents <FactStoreSpell>(c => c.storeSpell(touch_spell));
                    }
                    else
                    {
                        store_buff.CallComponents <FactStoreSpell>(c => c.storeSpell(spell));
                    }
                }
            }
 public DelayedGainAttackAbility(Enumerators.CardKind cardKind, AbilityData ability)
     : base(cardKind, ability)
 {
     Value = ability.Value;
 }
Пример #40
0
 bool IsWishSpell(AbilityData spell) => spell?.Fact != null && abilities.Contains(spell.Fact);
Пример #41
0
    //////////////////////////////////////////
    /// CheckForBonuses()
    /// Checks for bonuses and alters the
    /// incoming damage based on them, if
    /// necessary.
    //////////////////////////////////////////
    private int CheckForBonuses( AbilityData i_dataAbility, int i_nDamage, CharacterModel i_charTarget, CharacterModel i_charAggressor ) {
        // get the list of bonuses on this ability
        List<BonusData> listBonuses = i_dataAbility.Bonuses;

        // go through each bonus data and add its bonus to the total damage
        foreach ( BonusData dataBonus in listBonuses ) {
            i_nDamage += dataBonus.GetBonusAmount( i_charAggressor, i_charTarget );
        }

        return i_nDamage;
    }
 public TakeControlEnemyUnitAbility(Enumerators.CardKind cardKind, AbilityData ability)
     : base(cardKind, ability)
 {
 }
Пример #43
0
    //////////////////////////////////////////
    /// QueueAction()
    /// Queues an action for whichever character
    /// is currently active.
    //////////////////////////////////////////
    private void QueueAction( AbilityData i_dataAbility ) {
        // char whose turn it is
        DefaultModel charCurrent = TurnManager.Instance.GetCurrentCharacter();

        QueueActionWithCharacter( i_dataAbility, charCurrent );
    }
Пример #44
0
 private void UseAutotargetAbility(AbilityData abilityData)
 {
     Roost.Debug.Assert(abilityData != null);
     Roost.Debug.Assert(this.m_baseCharacterController != null);
     base.UseAbility(abilityData, this.SelectTarget(abilityData));
 }
Пример #45
0
    // Load attribute and ability data
    public bool LoadAttributeAbilityData()
    {
        // TODO: add new attributes and abilities here.
        AttributeData attrData = new AttributeData();
        attrData.Name = "属性1";

        _Attributes [0] = attrData;

        AbilityData abData = new AbilityData();
        abData.Name = "技能1";

        _Abilities [0] = abData;

        return true;
    }
Пример #46
0
 public void Setup(Unit _Caster, AbilityData _ability)
 {
     Caster           = _Caster;
     TargetLimitCount = _ability.targetCount;
     SkillAbilityLists.Add(_ability);
 }
Пример #47
0
        public void Calculate()
        {
            if( this.IsCalculated )
                throw new ApplicationException( "Already calculated" );

            System.Diagnostics.Stopwatch timer = new System.Diagnostics.Stopwatch();
            timer.Start();

            int minimum = int.MaxValue, maximum = 0;

            this.minimumAutoAttack = this.minimumCritical = int.MaxValue;
            this.maximumAutoAttack = this.maximumCritical = 0;
            this.maximumHealing = 0;
            this.maximumNonCriticalHealing = this.maximumCriticalHealing = 0;

            //if( this.SourceName == "Ezarin"
            //    && this.TargetName == "Gloamsilk Venom" )
            //    System.Diagnostics.Debugger.Break();

            foreach( CombatLogEntry entry in this.log )
            {
                //if( !this.UseLogEntry( entry ) ) continue;

                this.numEntries++;

                if( entry.SourceId.Value == this.sourceId )
                {
                    if( entry.IsHit ) this.numHits++;
                    if( entry.IsMiss ) this.numMisses++;
                    if( entry.IsHeal ) this.numHeals++;
                    if( entry.IsResist ) this.numResisted++;
                    if( entry.IsHit && entry.IsCritical ) this.numCriticals++;
                    if( entry.IsDeath ) this.numKills++;
                    if( entry.IsAutoAttack && entry.IsHit ) this.numAutoAttacks++;

                    // Count total number of targets
                    if( entry.IsHit && entry.Damage > 0 )
                    {
                        // Damage targets
                        if( entry.TargetId.Value != entry.SourceId.Value
                            && !this.targets.Contains( entry.TargetId.Value ) )
                            this.targets.Add( entry.TargetId.Value );
                    }
                    else if( entry.IsHeal && entry.Damage > 0 )
                    {
                        // Heal targets
                        if( entry.TargetId.Value != entry.SourceId.Value
                            && !this.healtargets.Contains( entry.TargetId.Value ) )
                            this.healtargets.Add( entry.TargetId.Value );
                    }

                    // For the purposes of DPS and HPS calculations,
                    // include "absorbed" and "overheal" values.
                    int damage = entry.Damage;
                    if( entry.IsHit && entry.Absorbed > 0 ) damage += entry.Absorbed;
                    if( entry.IsHeal && entry.Overheal > 0 ) damage += entry.Overheal;

                    if( entry.IsHit )
                        this.totalDamage += damage;

                    if( entry.IsHit && entry.DamageType == "Physical" )
                        this.totalPhysicalDamage += damage;
                    if( entry.IsHit && entry.DamageType == "Death" )
                        this.totalDeathDamage += damage;
                    if( entry.IsHit && entry.DamageType == "Life" )
                        this.totalLifeDamage += damage;
                    if( entry.IsHit && entry.DamageType == "Air" )
                        this.totalAirDamage += damage;
                    if( entry.IsHit && entry.DamageType == "Earth" )
                        this.totalEarthDamage += damage;
                    if( entry.IsHit && entry.DamageType == "Water" )
                        this.totalWaterDamage += damage;
                    if( entry.IsHit && entry.DamageType == "Fire" )
                        this.totalFireDamage += damage;

                    if( entry.IsHit && entry.IsAutoAttack )
                        this.totalAutoDamage += damage;
                    else
                    {
                        if( entry.IsHit && entry.Category == 4 )
                            this.totalDotDamage += damage;
                        if( entry.IsHit && entry.Category == 3 )
                            this.totalNormalDamage += damage;
                        if( entry.IsHit && entry.Category == 23 )
                            this.totalCriticalDamage += damage;
                    }

                    if( entry.IsHeal )
                    {
                        this.totalHealing += damage;
                        if( damage < this.minimumHealing )
                            this.minimumHealing = damage;
                        if( damage > this.maximumHealing )
                            this.maximumHealing = damage;
                        if( entry.IsCritical && damage > this.maximumCriticalHealing )
                            this.maximumCriticalHealing = damage;
                        else if( !entry.IsCritical && damage > this.maximumNonCriticalHealing )
                            this.maximumNonCriticalHealing = damage;
                    }

                    this.totalOverkill += entry.Overkill;
                    this.totalOverheal += entry.Overheal;

                    if( entry.IsHit )
                    {
                        if( damage < minimum )
                            minimum = damage;
                        if( damage > maximum )
                        {
                            maximum = damage;
                            this.maximumAbilityName = entry.AbilityName;
                        }

                        if( entry.IsCritical )
                        {
                            if( damage < this.minimumCritical )
                                this.minimumCritical = damage;
                            else if( damage > this.maximumCritical )
                                this.maximumCritical = damage;
                        }
                        else if( entry.IsAutoAttack )
                        {
                            if( damage < this.minimumAutoAttack )
                                this.minimumAutoAttack = damage;
                            else if( damage > this.maximumAutoAttack )
                                this.maximumAutoAttack = damage;
                        }
                    }

                    // Record breakdown of abilities (Void Bolt, Fireball, etc.)
                    if( damage > 0 )
                    {
                        string key = entry.AbilityName;
                        if( !this.abilities.ContainsKey( key ) )
                        {
                            AbilityData data = new AbilityData();
                            data.DataName = key;
                            data.Total = 0;
                            data.NumCriticals = 0;
                            this.abilities.Add( key, data );
                        }
                        this.abilities[key].DataPoints.Add( damage );
                        this.abilities[key].Total += damage;
                        if( entry.IsCritical )
                            this.abilities[key].NumCriticals++;

                        // Record this person's rotation of abilities
                        if( !entry.IsAutoAttack )
                            this.rotation.Add( entry.AbilityName );
                    }

                    // Record breakdown of damage types (Air, Water, Physical)
                    if( damage > 0 && entry.DamageType != null )
                    {
                        string key = entry.DamageType;
                        if( !this.damageTypes.ContainsKey( key ) )
                        {
                            AbilityData data = new AbilityData();
                            data.DataName = key;
                            data.Total = 0;
                            data.NumCriticals = 0;
                            this.damageTypes.Add( key, data );
                        }
                        this.damageTypes[key].DataPoints.Add( damage );
                        this.damageTypes[key].Total += damage;
                        if( entry.IsCritical )
                            this.damageTypes[key].NumCriticals++;
                    }

                }
                else if( entry.TargetId.Value == this.sourceId )
                {
                    // Count total number of attackers
                    if( entry.IsHit )
                    {
                        if( entry.SourceId.Value != entry.TargetId.Value
                            && !this.attackers.Contains( entry.SourceId.Value ) )
                            this.attackers.Add( entry.SourceId.Value );
                    }

                    if( entry.IsHit ) this.receivedDamage += entry.Damage;
                    if( entry.IsHeal ) this.receivedHealing += entry.Damage;

                    if( entry.IsDodge ) this.numDodges++;
                    if( entry.IsParry ) this.numParries++;
                    if( entry.IsResist ) this.numResists++;

                    if( entry.IsDeath ) this.numDeaths++;

                    this.totalBlocked += entry.Blocked;
                    this.totalAbsorbed += entry.Absorbed;
                }
            }

            this.minimumDamage = minimum;
            this.maximumDamage = maximum;

            if( this.minimumDamage == int.MaxValue )
                this.minimumDamage = 0;
            if( this.minimumAutoAttack == int.MaxValue )
                this.minimumAutoAttack = 0;
            if( this.minimumCritical == int.MaxValue )
                this.minimumCritical = 0;

            // Sanity checks
            if( this.maximumDamage < this.minimumDamage )
                this.maximumDamage = this.minimumDamage;
            if( this.maximumAutoAttack < this.minimumAutoAttack )
                this.maximumAutoAttack = this.minimumAutoAttack;
            if( this.maximumCritical < this.minimumCritical )
                this.maximumCritical = this.minimumCritical;

            if( this.numHits > 0 )
                this.critPercentage = this.numCriticals * 100 / this.numHits;

            TimeSpan elapsed = this.Elapsed; // compute elapsed time too

            timer.Stop();

            //Console.WriteLine( "Calculated {0:N0} entries in {1:N3} seconds.",
            //	this.log.Count, timer.ElapsedMilliseconds / 1000.0 );

            this.isCalculated = true;
        }
Пример #48
0
 public override void StartEffect(AbilityData data, Action finished)
 {
     data.GetUser().transform.LookAt(data.GetTargetedPoint());
     finished();
 }
Пример #49
0
 public override void StartEffect(AbilityData data, Action finished)
 {
     data.StartCoroutine(Effect(data, finished));
 }
 public BuffAbilityParams(AbilityData data)
 {
     _data = data;
 }
 internal static bool canUseSpellForSpellCombat(UnitPartMagus unit_part_magus, AbilityData ability)
 {
     if (unit_part_magus.Owner.HasFact(ray_spell_combat))
     {
         return(unit_part_magus.IsSuitableForEldritchArcherSpellStrike(ability));
     }
     else
     {
         return(unit_part_magus.IsSpellFromMagusSpellList(ability));
     }
 }