public void MakeAction()
    {
        FightActionData fightActiondata = new FightActionData();

        AppearanceConfigData.MagicAppearanceData appearance;

        if (!_isSecret)
        {
            appearance = AppearanceConfigData.instance.GetMagicWithIndex(owner.moniker, _index);
        }
        else
        {
            appearance = AppearanceConfigData.instance.GetSecretWithIndex(_secretType);
        }

        SpellInfo spellInf = MakeSpellInfo(appearance, _spellEffectInfoes, _index);

        fightActiondata.ownerID             = owner.id;
        fightActiondata.spellInfo           = spellInf;
        fightActiondata.consumedActionPoint = _actionPointAmount;

        if (Event_ActionGenerated != null)
        {
            Event_ActionGenerated(fightActiondata);
        }
    }
Example #2
0
    private List <ActionData> MakeFightAction(WFightAction fightActions)
    {
        List <ActionData> actionList = new List <ActionData>();

        for (int n = 0; n < fightActions.f_acts.Length; n++)
        {
            WFightActionData fightAc = fightActions.f_acts[n];

            FightActionData fad = new FightActionData();

            var effectsInfo = new List <SpellEffectInfo>();

            AppearanceConfigData.MagicAppearanceData appearance;
            appearance = AppearanceConfigData.instance.GetMagicWithIndex(_battleLogic.GetCharacterWithID(fightAc.owner_id).moniker,
                                                                         fightAc.spell_index);
            fad.consumedActionPoint = fightAc.con_ap;
            fad.ownerID             = fightAc.owner_id;

            //if (appearance._multiplePartDamage != null && appearance._multiplePartDamage.Count > 0)
            //{
            //    effectsInfo = multipart(appearance._multiplePartDamage, effectsInfo);
            //}

            for (int i = 0; i < fightAc.spell_effect_info.Length; i++)
            {
                BattleObjStats finalStat = MakeBattleObject(fightAc.spell_effect_info[i].final_character_stats);

                List <SpellSingleStatChangeInfo> statChanges = MakeSingleStatChangeList(
                    fightAc.spell_effect_info[i].single_stat_changes);

                SpellEffectInfo effect = new SpellEffectInfo(statChanges,
                                                             fightAc.spell_effect_info[i].target_character_id,
                                                             fightAc.spell_effect_info[i].effect_on_character,
                                                             finalStat);
                effectsInfo.Add(effect);
            }

            fad.spellInfo = new SpellInfo(
                fightAc.spell_index,
                appearance._isInstant, appearance._dontShowToUser, appearance._needTargetToComeNear,
                appearance._spellName, appearance._cost, appearance._prefabName,
                fightAc.spell_type, appearance._damageType, appearance._spellImpact, effectsInfo);

            fad.spellInfo.generatedActionPoint = fightAc.gen_ap;
            fad.spellInfo.isCritical           = fightAc.is_critical;

            actionList.Add(fad);
        }

        return(actionList);
    }
Example #3
0
    public List <ActionData> MakeFightActionDataList(Divine.BattleActionData action)
    {
        var result = new List <ActionData>();

        foreach (var spell in action.Spell)
        {
            var effectsInfo = new List <SpellEffectInfo>();
            var isCritical  = spell.Effect.Count > 0 && spell.Effect[0].Type == Divine.SpellEffectType.Critical;

            foreach (var effect in spell.Effect)
            {
                var statChanges = new List <SpellSingleStatChangeInfo>();
                var stat        = _curStats[effect.Target];

                int hpChange     = 0;
                int shieldChange = 0;

                foreach (var change in effect.Change)
                {
                    switch (change.Type)
                    {
                    case Divine.StatType.Health:
                        hpChange += change.Value;
                        stat.SetHP(stat.hp + change.Value);
                        break;

                    case Divine.StatType.Shield:
                        shieldChange += change.Value;
                        stat.SetShield(stat.shield + change.Value);
                        break;

                    case Divine.StatType.Attack:
                        statChanges.Add(new SpellSingleStatChangeInfo(
                                            SpellSingleStatChangeType.curDamageValChange,
                                            change.Value));
                        stat.damage += change.Value;
                        break;

                    case Divine.StatType.Flag:
                        statChanges.Add(new SpellSingleStatChangeInfo(
                                            SpellSingleStatChangeType.curFlagValChange,
                                            change.Value));
                        stat.flags = (BattleFlags)change.Value;
                        break;
                    }
                }

                if (hpChange != 0)
                {
                    statChanges.Add(new SpellSingleStatChangeInfo(
                                        SpellSingleStatChangeType.curHPValChange,
                                        hpChange));

                    if (effect.Target > 0 && _curStats.ContainsKey(-effect.Target))
                    {
                        _curStats[-effect.Target].SetHP(_curStats[-effect.Target].hp + hpChange);
                    }
                }

                if (shieldChange != 0)
                {
                    statChanges.Add(new SpellSingleStatChangeInfo(
                                        SpellSingleStatChangeType.curShieldValChange,
                                        shieldChange));
                }

                effectsInfo.Add(new SpellEffectInfo(statChanges, effect.Target, translate(effect.Type), (BattleObjStats)stat.Clone()));
            }

            AppearanceConfigData.MagicAppearanceData appearance;
            int spellIndex;
            if (spell.Spell < 100)
            {
                spellIndex = spell.Spell;
                appearance = AppearanceConfigData.instance.GetMagicWithIndex(_monikers[spell.Attacker], spellIndex);

                if (appearance._multiplePartDamage != null && appearance._multiplePartDamage.Count > 0)
                {
                    effectsInfo = multipart(appearance._multiplePartDamage, effectsInfo);
                }

                var fightAction = new FightActionData();
                fightAction.consumedActionPoint            = spell.ConsumedActionPoint;
                fightAction.ownerID                        = spell.Attacker;
                fightAction.spellInfo.generatedActionPoint = spell.GeneratedActionPoint;

                result.Add(fightAction);
            }
            else if (spell.Spell < 1000)
            {
                spellIndex = spell.Spell - 100;
                var secret = getSide(spell.Attacker).partyInfo.availableSecrets[spellIndex];
                appearance = AppearanceConfigData.instance.GetSecretWithIndex(secret);

                var fightAction = new SecretActionData();
                fightAction.ownerID    = spell.Attacker;
                fightAction._spellInfo = new SpellInfo(
                    spellIndex,
                    true, appearance._dontShowToUser, appearance._needTargetToComeNear,
                    appearance._spellName, appearance._cost, appearance._prefabName,
                    appearance._spellType, appearance._damageType, appearance._spellImpact, effectsInfo);
                fightAction._spellInfo.generatedActionPoint = spell.GeneratedActionPoint;

                result.Add(fightAction);
            }
            else
            {
                var fightAction = new FightActionData();
                fightAction.ownerID   = spell.Attacker;
                fightAction.spellInfo = new SpellInfo(
                    0, false, false, false,
                    PREFAB_DAMAGERETURN, 0, PREFAB_DAMAGERETURN,
                    SpellType.DamageReturn, DamageType.Low, SpellImpactType.None, effectsInfo);

                result.Add(fightAction);
            }
        }

        return(result);
    }