示例#1
0
        /// <Summary>
        /// Just display the currrent step number in the battle replay control panel.
        /// </Summary>
        private void SetStepNumber(BattleStep thisStep)
        {
            StringBuilder title = new StringBuilder();

            title.AppendFormat(
                "Step {0} of {1}: {2}",
                eventCount + 1,
                theBattle.Steps.Count,
                thisStep.Type
                );


            stepNumber.Text = title.ToString();
        }
        public void SetLastBattleData(DataBattle data)
        {
            Debug.LogWarning("!!!!!!!!!!!!!!!!!!!!!! SetLastBattleData() !!!!!!!!!!!!!!!!!!!!!!");
            string dlog = "missionID = " + data.MissionID;

            dlog += ",\t\t roundCount = " + data.Round_count;
            dlog += ",\t\t Win_idx = " + data.Win_idx;
            Debug.LogWarning(dlog);
            ClearBattleData();//clear first
            missionID    = (int)data.MissionID;
            roundCount   = data.Round_count;
            isPlayed     = false;
            isLastBattle = true;
            isWin        = !Convert.ToBoolean(data.Win_idx);
            foreach (xjgame.message.DropBag bag in data.dropsList)
            {
                DropBag drop_bag = new DropBag();
                drop_bag.type = (DropType)bag.Type;
                drop_bag.val  = bag.Value;
                winDropBags.Add(drop_bag);
            }
            addExp = data.Add_exp;
            //test
            if (Obj_MyselfPlayer.GetMe().currentAssistFriend == null)
            {
                Obj_MyselfPlayer.GetMe().currentAssistFriend = new AssistFriend();
                Obj_MyselfPlayer.GetMe().currentAssistFriend.guid = (long)data.Friendguid;
                Obj_MyselfPlayer.GetMe().currentAssistFriend.name = data.Friendname;
                Obj_MyselfPlayer.GetMe().currentAssistFriend.level = data.Friendlevel;
                Obj_MyselfPlayer.GetMe().currentAssistFriend.cardLevel = data.FriendCardLev;
                Obj_MyselfPlayer.GetMe().currentAssistFriend.friendShipNum = data.GetFriendPoint;
                if (data.IsFriend == 0)
                {
                    Obj_MyselfPlayer.GetMe().currentAssistFriend.isMyFriend = true;
                }
                else
                {
                    Obj_MyselfPlayer.GetMe().currentAssistFriend.isMyFriend = false;
                }
            }
            foreach (xjgame.message.BattleCard card in data.userCardList)
            {
                string log = "Card: slot_idx = " + card.Place_idx + ",\t\t cardid = " + card.CardID + ",\t\t guid = " + card.Cardguid;
                log += ",\t\t state = " + card.State;
                log += ",\t\t isfriend = " + card.Isfriend;
                log += ",\t\t commSkillID = " + card.CommSkillId;
                log += ",\t\t volSkillID = " + card.VolSkillId;
                log += ",\t\t combSkillID = " + card.CombSkillId;

                if (card.Place_idx < 6)
                {
                    TroopMember member = new TroopMember(card.Place_idx, card.CardID, (long)card.Cardguid);
                    member.state       = card.State;
                    member.initHp      = card.Init_hp;
                    member.commSkillID = card.CommSkillId;
                    member.volSkillID  = card.VolSkillId;
                    member.combSkillID = card.CombSkillId;
                    if (card.Bag != null)
                    {
                        member.bag.type = (DropType)card.Bag.Type;
                        member.bag.val  = card.Bag.Value;
                        log            += ",\t\t DropBag.Type = " + card.Bag.Type;
                        log            += ",\t\t DropBag.Value = " + card.Bag.Value;
                    }
                    troopData.selfMembers.Add(member);
                    if (card.Isfriend == 1)
                    {
                        Obj_MyselfPlayer.GetMe().currentAssistFriend.cardGuiId = (long)card.Cardguid;
                        Obj_MyselfPlayer.GetMe().currentAssistFriend.cardTempleId = card.CardID;
                        Obj_MyselfPlayer.GetMe().battleArray[card.Place_idx] = (long)card.Cardguid;
                    }
                }
                else
                {
                    TroopMember member = new TroopMember(card.Place_idx, card.CardID, (long)card.Cardguid);
                    member.state       = card.State;
                    member.initHp      = card.Init_hp;
                    member.commSkillID = card.CommSkillId;
                    member.volSkillID  = card.VolSkillId;
                    member.combSkillID = card.CombSkillId;
                    if (card.Bag != null)
                    {
                        member.bag.type = (DropType)card.Bag.Type;
                        member.bag.val  = card.Bag.Value;
                        log            += ",\t\t DropBag.Type = " + card.Bag.Type;
                        log            += ",\t\t DropBag.Value = " + card.Bag.Value;
                    }
                    troopData.otherMembers.Add(member);
                }
                Debug.LogWarning(log);
            }

            foreach (DataRound round in data.roundsList)
            {
                BattleTurn turn = new BattleTurn();
                foreach (DataAction action in round.actionsList)
                {
                    BattleStep step = new BattleStep();
                    foreach (DataSingleAction sact in action.attacker_actionsList)
                    {
                        string log = "Attack action: ";
                        log += ",\t\t card_idx = " + sact.Card_idx;
                        log += ",\t\t skillid = " + sact.Skillid;
                        log += ",\t\t att_value = " + sact.Att_value;
                        log += ",\t\t att_type = " + sact.Att_type;
                        log += ",\t\t beCrit = " + sact.BeCrit;
                        log += ",\t\t cur_hp = " + sact.Cur_hp;
                        log += ",\t\t heti_idx = " + sact.Heti_idx;

                        StepAction attack = new StepAction();
                        if (sact.buffInfoList != null)
                        {
                            foreach (DataBuffInfo buf in sact.buffInfoList)
                            {
                                BuffInfo attBuf = new BuffInfo();
                                attBuf.buf_id    = buf.Buf_id;
                                attBuf.buf_value = buf.Buf_value;
                                attack.buff.Add(attBuf);
                                log += ",\t\t buf.Buf_id = " + buf.Buf_id;
                                log += ",\t\t buf.Buf_value = " + buf.Buf_value;
                            }
                        }
                        attack.slotIndex = sact.Card_idx;
                        attack.skillID   = sact.Skillid;
                        attack.attackHp  = sact.Att_value;
                        attack.harmType  = sact.Att_type;
                        attack.isStorm   = Convert.ToBoolean(sact.BeCrit);
                        attack.curHp     = sact.Cur_hp;
                        if (sact.HasHeti_idx)
                        {
                            attack.hetiIndex = sact.Heti_idx;
                        }
                        step.attacks.Add(attack);
                        Debug.LogWarning(log);
                    }

                    foreach (DataSingleAction sact in action.be_attacker_actionsList)
                    {
                        string log = "Behit action: ";
                        log += ",\t\t card_idx = " + sact.Card_idx;
                        log += ",\t\t skillid = " + sact.Skillid;
                        log += ",\t\t att_value = " + sact.Att_value;
                        log += ",\t\t att_type = " + sact.Att_type;
                        log += ",\t\t beCrit = " + sact.BeCrit;
                        log += ",\t\t cur_hp = " + sact.Cur_hp;
                        log += ",\t\t heti_idx = " + sact.Heti_idx;

                        StepAction behit = new StepAction();
                        if (sact.buffInfoList != null)
                        {
                            foreach (DataBuffInfo buf in sact.buffInfoList)
                            {
                                BuffInfo behitBuf = new BuffInfo();
                                behitBuf.buf_id    = buf.Buf_id;
                                behitBuf.buf_value = buf.Buf_value;
                                behit.buff.Add(behitBuf);
                                log += ",\t\t buf.Buf_id = " + buf.Buf_id;
                                log += ",\t\t buf.Buf_value = " + buf.Buf_value;
                            }
                        }
                        behit.slotIndex = sact.Card_idx;
                        behit.skillID   = sact.Skillid;
                        behit.attackHp  = sact.Att_value;
                        behit.harmType  = sact.Att_type;
                        behit.isStorm   = Convert.ToBoolean(sact.BeCrit);
                        behit.curHp     = sact.Cur_hp;
                        step.behits.Add(behit);
                        Debug.LogWarning(log);
                    }
                    turn.battleSteps.Add(step);
                }
                battleRound.battleTurns.Add(turn);
            }
            Obj_MyselfPlayer.GetMe().SetBattleBeforeDate();
        }
        public void SetPVPBattleData(SCPVPBattleData data)
        {
            ClearBattleData();//clear first

            //pb data
            pbBaseData = data.BaseData;
            pbBagData  = data.BagData;
            pbCopyData = data.CopyData;

            isPlayed     = false;
            isLastBattle = false;
            isWin        = !Convert.ToBoolean(data.Battle.Win_idx);
            foreach (xjgame.message.DropBag bag in data.Battle.dropsList)
            {
                DropBag drop_bag = new DropBag();
                drop_bag.type = (DropType)bag.Type;
                drop_bag.val  = bag.Value;
                winDropBags.Add(drop_bag);
            }
            addExp = data.Battle.Add_exp;

            Debug.LogWarning("!!!!!!!!!!!!!!!!!!!!!! SetPVPBattleData() !!!!!!!!!!!!!!!!!!!!!!");
            foreach (xjgame.message.BattleCard card in data.Battle.userCardList)
            {
                string log = "Card: slot_idx = " + card.Place_idx + ",\t\t cardid = " + card.CardID + ",\t\t guid = " + card.Cardguid;
                log += ",\t\t state = " + card.State;
                log += ",\t\t commSkillID = " + card.CommSkillId;
                log += ",\t\t volSkillID = " + card.VolSkillId;
                log += ",\t\t combSkillID = " + card.CombSkillId;

                if (card.Place_idx < 6)
                {
                    TroopMember member = new TroopMember(card.Place_idx, card.CardID, (long)card.Cardguid);
                    member.state       = card.State;
                    member.initHp      = card.Init_hp;
                    member.commSkillID = card.CommSkillId;
                    member.volSkillID  = card.VolSkillId;
                    member.combSkillID = card.CombSkillId;
                    if (card.Bag != null)
                    {
                        member.bag.type = (DropType)card.Bag.Type;
                        member.bag.val  = card.Bag.Value;
                        log            += ",\t\t DropBag.Type = " + card.Bag.Type;
                        log            += ",\t\t DropBag.Value = " + card.Bag.Value;
                    }
                    troopData.selfMembers.Add(member);
                }
                else
                {
                    TroopMember member = new TroopMember(card.Place_idx, card.CardID, (long)card.Cardguid);
                    member.state       = card.State;
                    member.initHp      = card.Init_hp;
                    member.commSkillID = card.CommSkillId;
                    member.volSkillID  = card.VolSkillId;
                    member.combSkillID = card.CombSkillId;
                    if (card.Bag != null)
                    {
                        member.bag.type = (DropType)card.Bag.Type;
                        member.bag.val  = card.Bag.Value;
                        log            += ",\t\t DropBag.Type = " + card.Bag.Type;
                        log            += ",\t\t DropBag.Value = " + card.Bag.Value;
                    }
                    troopData.otherMembers.Add(member);
                }
                Debug.LogWarning(log);
            }

            foreach (DataRound round in data.Battle.roundsList)
            {
                BattleTurn turn = new BattleTurn();
                foreach (DataAction action in round.actionsList)
                {
                    BattleStep step = new BattleStep();
                    foreach (DataSingleAction sact in action.attacker_actionsList)
                    {
                        string log = "Attack action: ";
                        log += ",\t\t card_idx = " + sact.Card_idx;
                        log += ",\t\t skillid = " + sact.Skillid;
                        log += ",\t\t att_value = " + sact.Att_value;
                        log += ",\t\t att_type = " + sact.Att_type;
                        log += ",\t\t beCrit = " + sact.BeCrit;
                        log += ",\t\t cur_hp = " + sact.Cur_hp;
                        log += ",\t\t heti_idx = " + sact.Heti_idx;

                        StepAction attack = new StepAction();
                        if (sact.buffInfoList != null)
                        {
                            foreach (DataBuffInfo buf in sact.buffInfoList)
                            {
                                BuffInfo attBuf = new BuffInfo();
                                attBuf.buf_id    = buf.Buf_id;
                                attBuf.buf_value = buf.Buf_value;
                                attack.buff.Add(attBuf);
                                log += ",\t\t buf.Buf_id = " + buf.Buf_id;
                                log += ",\t\t buf.Buf_value = " + buf.Buf_value;
                            }
                        }
                        attack.slotIndex = sact.Card_idx;
                        attack.skillID   = sact.Skillid;
                        attack.attackHp  = sact.Att_value;
                        attack.harmType  = sact.Att_type;
                        attack.isStorm   = Convert.ToBoolean(sact.BeCrit);
                        attack.curHp     = sact.Cur_hp;
                        if (sact.HasHeti_idx)
                        {
                            attack.hetiIndex = sact.Heti_idx;
                        }
                        step.attacks.Add(attack);
                        Debug.LogWarning(log);
                    }

                    foreach (DataSingleAction sact in action.be_attacker_actionsList)
                    {
                        string log = "Behit action: ";
                        log += ",\t\t card_idx = " + sact.Card_idx;
                        log += ",\t\t skillid = " + sact.Skillid;
                        log += ",\t\t att_value = " + sact.Att_value;
                        log += ",\t\t att_type = " + sact.Att_type;
                        log += ",\t\t beCrit = " + sact.BeCrit;
                        log += ",\t\t cur_hp = " + sact.Cur_hp;
                        log += ",\t\t heti_idx = " + sact.Heti_idx;

                        StepAction behit = new StepAction();
                        if (sact.buffInfoList != null)
                        {
                            foreach (DataBuffInfo buf in sact.buffInfoList)
                            {
                                BuffInfo behitBuf = new BuffInfo();
                                behitBuf.buf_id    = buf.Buf_id;
                                behitBuf.buf_value = buf.Buf_value;
                                behit.buff.Add(behitBuf);
                                log += ",\t\t buf.Buf_id = " + buf.Buf_id;
                                log += ",\t\t buf.Buf_value = " + buf.Buf_value;
                            }
                        }
                        behit.slotIndex = sact.Card_idx;
                        behit.skillID   = sact.Skillid;
                        behit.attackHp  = sact.Att_value;
                        behit.harmType  = sact.Att_type;
                        behit.isStorm   = Convert.ToBoolean(sact.BeCrit);
                        behit.curHp     = sact.Cur_hp;
                        step.behits.Add(behit);
                        Debug.LogWarning(log);
                    }
                    turn.battleSteps.Add(step);
                }
                battleRound.battleTurns.Add(turn);
            }
        }
        private void SetDataRound(IList <DataRound> dataRound)
        {
            foreach (DataRound round in dataRound)
            {
                BattleTurn turn = new BattleTurn();
                foreach (DataAction action in round.actionsList)
                {
                    BattleStep step = new BattleStep();
                    foreach (DataSingleAction sact in action.attacker_actionsList)
                    {
                        string log = "Attack action: ";
                        log += ",\t\t card_idx = " + sact.Card_idx;
                        log += ",\t\t skillid = " + sact.Skillid;
                        log += ",\t\t att_value = " + sact.Att_value;
                        log += ",\t\t att_type = " + sact.Att_type;
                        log += ",\t\t beCrit = " + sact.BeCrit;
                        log += ",\t\t cur_hp = " + sact.Cur_hp;
                        log += ",\t\t heti_idx = " + sact.Heti_idx;

                        StepAction attack = new StepAction();
                        if (sact.buffInfoList != null)
                        {
                            foreach (DataBuffInfo buf in sact.buffInfoList)
                            {
                                BuffInfo attBuf = new BuffInfo();
                                attBuf.buf_id    = buf.Buf_id;
                                attBuf.buf_value = buf.Buf_value;
                                attack.buff.Add(attBuf);
                                log += ",\t\t buf.Buf_id = " + buf.Buf_id;
                                log += ",\t\t buf.Buf_value = " + buf.Buf_value;
                            }
                        }
                        attack.slotIndex = sact.Card_idx;
                        attack.skillID   = sact.Skillid;
                        attack.attackHp  = sact.Att_value;
                        attack.harmType  = sact.Att_type;
                        attack.isStorm   = Convert.ToBoolean(sact.BeCrit);
                        attack.curHp     = sact.Cur_hp;
                        if (sact.HasHeti_idx)
                        {
                            attack.hetiIndex = sact.Heti_idx;
                        }
                        step.attacks.Add(attack);
                        Debug.LogWarning(log);
                    }

                    foreach (DataSingleAction sact in action.be_attacker_actionsList)
                    {
                        string log = "Behit action: ";
                        log += ",\t\t card_idx = " + sact.Card_idx;
                        log += ",\t\t skillid = " + sact.Skillid;
                        log += ",\t\t att_value = " + sact.Att_value;
                        log += ",\t\t att_type = " + sact.Att_type;
                        log += ",\t\t beCrit = " + sact.BeCrit;
                        log += ",\t\t cur_hp = " + sact.Cur_hp;
                        log += ",\t\t heti_idx = " + sact.Heti_idx;

                        StepAction behit = new StepAction();
                        if (sact.buffInfoList != null)
                        {
                            foreach (DataBuffInfo buf in sact.buffInfoList)
                            {
                                BuffInfo behitBuf = new BuffInfo();
                                behitBuf.buf_id    = buf.Buf_id;
                                behitBuf.buf_value = buf.Buf_value;
                                behit.buff.Add(behitBuf);
                                log += ",\t\t buf.Buf_id = " + buf.Buf_id;
                                log += ",\t\t buf.Buf_value = " + buf.Buf_value;
                            }
                        }
                        behit.slotIndex = sact.Card_idx;
                        behit.skillID   = sact.Skillid;
                        behit.attackHp  = sact.Att_value;
                        behit.harmType  = sact.Att_type;
                        behit.isStorm   = Convert.ToBoolean(sact.BeCrit);
                        behit.curHp     = sact.Cur_hp;
                        step.behits.Add(behit);
                        Debug.LogWarning(log);
                    }
                    turn.battleSteps.Add(step);
                }
                battleRound.battleTurns.Add(turn);
            }
        }
示例#5
0
        public override void Update()
        {
            isInputEventNowFrame = false;
            //uiStep
            switch (uiStep)
            {
            case UIStep.None:
                break;

            case UIStep.SkillSelect:
                break;

            case UIStep.SkillTargetSelect:
            {
                if ((InputCore.Instance.GetKeyEventType(InputCore.KeyEventCode.MouseRightButton) == InputCore.KeyEventType.Up))
                {
                    if (!isInputEventNowFrame)
                    {
                        isInputEventNowFrame = true;
                        uiStep = UIStep.None;
                        new Emugen.Sound.SoundPlayer(MainConfig.SoundEffect.UICancel01, 0.10f, false, Emugen.Sound.SoundPlayer.SoundType.SE);
                    }
                }
            }
            break;
            }

            if (battleStep == BattleStep.Main)
            {
                Data.DataCreater.Instance.Update();                                // 行動シンボルの増加を戦闘中のみに限定するためのif文
            }
            SkillCards.Update();
            PlayerCards.Update();
            EnemyCards.Update();


            switch (battleStep)
            {
            case BattleStep.Main:
                if (actionTimer == 0)
                {
                    Action         action    = null;
                    Data.Character character = null;
                    foreach (var i in DataCreater.Instance.playerCharacters)
                    {
                        if (i.ActionStock != null)
                        {
                            action    = i.ActionStock;
                            character = i;
                        }
                    }
                    foreach (var i in DataCreater.Instance.enemyCharacters)
                    {
                        if (i.ActionStock != null)
                        {
                            action    = i.ActionStock;
                            character = i;
                        }
                    }
                    if (action != null)
                    {
                        action();
                        character.ActionStock = null;
                    }
                    actionTimer = actionTimerMax;
                }
                else
                {
                    actionTimer--;
                }

                if (EnemyCards.Count == 0)
                {
                    battleStep = BattleStep.End;

                    var bgm = new Emugen.Sound.SoundPlayer(Config.MainConfig.BattleScene.BGMStageClear, 0.20f, true, Emugen.Sound.SoundPlayer.SoundType.BGM);
                }
                else if (DataCreater.Instance.IsPlayerCharacterAllDead())
                {
                    battleStep = BattleStep.LostClickWait;

                    var choice = new UI.Talk.Choice(new string[] { "もう一度戦う", "タイトルに戻る" });
                    layer.Add(choice, 200);

                    LostClickWaitChoice = choice;
                    var bgm = new Emugen.Sound.SoundPlayer(Config.MainConfig.BattleScene.BGMGameOver, 0.20f, true, Emugen.Sound.SoundPlayer.SoundType.BGM);
                }
                else
                {
                    var data = Data.DataCreater.Instance;

                    var tmp = new List <Data.Character>();

                    foreach (var i in data.enemyCharacters.Where(x => x.HP.Now <= 0))
                    {
                        tmp.Add(i);
                    }

                    foreach (var i in tmp)
                    {
                        EnemyCards.Del(i.enemyCard);
                        data.enemyCharacters.Remove(i);
                    }
                }
                break;

            case BattleStep.LostClickWait:
            {
                LostClickWaitChoice.Update();

                var input = Emugen.Input.InputCore.Instance;
                if ((input.GetKeyEventType(Emugen.Input.InputCore.KeyEventCode.MouseLeftButton) == Emugen.Input.InputCore.KeyEventType.Up))
                {
                    var tmp = LostClickWaitChoice.GetChoiseText();

                    switch (tmp)
                    {
                    case "もう一度戦う":
                    {
                        var data = Data.DataCreater.Instance;
                        var i    = 0;
                        foreach (var v in retrayPlayerCaracters)
                        {
                            var chara = data.playerCharacters[i];
                            chara.HP.Now          = v.HP.Now;
                            chara.elementTimer    = v.elementTimer;
                            chara.ElementLing.pos = v.ElementLing.pos;
                            chara.Elements.Clear();
                            foreach (var element in v.Elements)
                            {
                                chara.Elements.Add(new Element(element.Name));
                            }
                            i++;
                        }
                        WindowManager.nextScene = new Scene.BattleScene(this.script.Path);
                    }
                    break;

                    case "タイトルに戻る":
                    {
                        WindowManager.nextScene = new Scene.TitleScene();
                    }
                    break;
                    }
                }
            }
            break;

            case BattleStep.End:
            {
                var input = Emugen.Input.InputCore.Instance;
                if ((input.GetKeyEventType(Emugen.Input.InputCore.KeyEventCode.MouseLeftButton) == Emugen.Input.InputCore.KeyEventType.Up))
                {
                    WindowManager.nextScene = new Scene.TalkScene(scriptAPI.__nextTalkScriptPath);
                }
            }
            break;
            }
        }
        internal void BattleComplete(object sender, BattleCompleteArgs args)
        {
            m_count++;

            int rem;
            int rounds = Math.DivRem(args.Steps.Count - 1, 3, out rem);

            if (rem > 0)
            {
                rounds++;
            }

            BattleStep lastStep = args.Steps[args.Steps.Count - 1];

            short[] attackerLosses = new short[args.Battle.Units.Length];
            for (int i = 0; i < attackerLosses.Length; i++)
            {
                attackerLosses[i] = (short)(args.Battle.Sides[(int)BattleSideType.Player].Counts[i] -
                                            lastStep.Sides[(int)BattleSideType.Player].Counts[i]);
            }

            short[] defenderLosses = new short[args.Battle.EnemyUnits.Length];
            for (int i = 0; i < defenderLosses.Length; i++)
            {
                defenderLosses[i] = (short)(args.Battle.Sides[(int)BattleSideType.Enemy].Counts[i] -
                                            lastStep.Sides[(int)BattleSideType.Enemy].Counts[i]);
            }

            bool winBattle = false;

            foreach (short attackerLoss in lastStep.Counts)
            {
                if (attackerLoss > 0)
                {
                    winBattle = true;
                    break;
                }
            }

            if (m_attackerLossesStatistics.ContainsKey(attackerLosses))
            {
                m_attackerLossesStatistics[attackerLosses] += 1;
            }
            else
            {
                m_attackerLossesStatistics[attackerLosses] = 1;
            }

            if (m_defenderLossesStatistics.ContainsKey(defenderLosses))
            {
                m_defenderLossesStatistics[defenderLosses] += 1;
            }
            else
            {
                m_defenderLossesStatistics[defenderLosses] = 1;
            }

            if (!winBattle)
            {
                rounds = -rounds;
            }

            if (RoundStatistics.ContainsKey(rounds))
            {
                RoundStatistics[rounds] += 1;
            }
            else
            {
                RoundStatistics[rounds] = 1;
            }
        }