/// <summary>
    /// 相手を選択
    /// </summary>
    /// <param name="monster"></param>
    private void SelectOpponent(BattleMapMonster monster)
    {
        BattleMapActionStatus actionStatus = holder.BattleMapStatus.BattleMapActionStatus;
        MonsterSkill          skill        = actionStatus.SelectedSkill;

        // ステータスを移動
        statusGenerator.ShowStatus(
            actionStatus.TargetMonster, BattleMapStatusPanelType.SKILL1, BattleMapStatusPanelPositionType.ON_RESERVE);
        statusGenerator.SetSkill(skill);

        // 相手のステータスを表示
        statusGenerator.ShowStatusReserve(monster, BattleMapStatusPanelType.SKILL1);

        // 距離を計算
        BattleMapTile from  = holder.BattleMap.GetByMonster(actionStatus.TargetMonster);
        BattleMapTile to    = holder.BattleMap.GetByMonster(monster);
        int           range = MapUtils.GetRange(from, to);

        // カウンタースキルを取得
        MonsterSkill counterSkill = monster.GetCounterSkill(range);

        statusGenerator.SetSkillReserve(counterSkill);

        // ステータスの更新
        actionStatus.BattleMapActionStatusType = BattleMapActionStatusType.CONFIRM_OPPONENT_SELECT;
        actionStatus.OpponentMonster           = monster;
        actionStatus.CounterSkill = counterSkill;
    }
 private void dataGridView_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
 {
     if (e.ColumnIndex == Offset.Index)
     {
         byte b = (byte)e.Value;
         e.Value             = b.ToString("X2");
         e.FormattingApplied = true;
     }
     else if ((e.ColumnIndex == Ability1.Index) ||
              (e.ColumnIndex == Ability2.Index) ||
              (e.ColumnIndex == Ability3.Index) ||
              (e.ColumnIndex == Beastmaster.Index))
     {
         if ((e.RowIndex >= 0) && (e.ColumnIndex >= 0) &&
             (dataGridView[e.ColumnIndex, e.RowIndex] is DataGridViewComboBoxCell) &&
             (dataGridView.Rows[e.RowIndex].DataBoundItem is MonsterSkill))
         {
             MonsterSkill skill = dataGridView.Rows[e.RowIndex].DataBoundItem as MonsterSkill;
             if (skill.Default != null)
             {
                 Ability a = ReflectionHelpers.GetFieldOrProperty <Ability>(skill.Default, dataGridView.Columns[e.ColumnIndex].DataPropertyName);
                 if (a != (e.Value as Ability))
                 {
                     e.CellStyle.BackColor = Settings.ModifiedColor.BackgroundColor;
                     e.CellStyle.ForeColor = Settings.ModifiedColor.ForegroundColor;
                 }
             }
         }
     }
 }
예제 #3
0
    /// <summary>
    /// 创建对应的MonsterSkill
    /// </summary>
    /// <returns>对应的 MonsterSkill实例</returns>
    public MonsterSkill CreateMe()
    {
        MonsterSkill retMonsterSkill = new MonsterSkill(
            this.monsterSkill_Id,
            this.monsterSkill_Name,
            this.forceCondition_Id,
            this.force_Object,
            this.energy_Change,
            this.san_Change,
            this.spineAnime_Name
            );

        //public int id = -1;
        //public string name = string.Empty;
        ///// <summary>施加的buff的id</summary>
        //public int buffId = -1;

        //public Enum.SubjectToEnum subjectTo = Enum.SubjectToEnum.player;

        //public int staminaValue = 0;
        //public int sanValue = 0;

        //public string spineFileName = string.Empty;

        return(retMonsterSkill);
    }
 private void pasteAll(object sender, EventArgs e)
 {
     if (copiedMonsterSkill != null)
     {
         MonsterSkill destMonsterSkill = dataGridView.CurrentRow.DataBoundItem as MonsterSkill;
         copiedMonsterSkill.CopyAllTo(destMonsterSkill);
         dataGridView.Invalidate();
     }
 }
    /// <summary>
    /// 範囲の描画
    /// </summary>
    /// <param name="skill"></param>
    /// <param name="monster"></param>
    private void DrawRange(MonsterSkill skill, BattleMapMonster monster)
    {
        BattleMapTile bmt = holder.BattleMap.GetByMonster(monster);

        // 範囲の取得
        List <BattleMapTile> list = MapUtils.GetRangeTileList(bmt, skill.Range);

        // 描画
        MapUtils.DrawRangeTile(new HashSet <BattleMapTile>(list), iconGenerator.InstallFrameAque);
    }
    /// <summary>
    /// スキルの色を差し替え
    /// </summary>
    /// <param name="monster"></param>
    private void SetSkillColorImage(MonsterSkill skill)
    {
        // スプライトを取得
        Sprite sprite = GetSkillColorImageSprite(skill.MonsterSkillType);

        // スプライトを差し替え
        GameObject go  = spObject.SkillButton;
        Image      img = go.GetComponent <Image>();

        img.sprite = sprite;
    }
    /// <summary>
    /// スキルのハイライト
    /// </summary>
    /// <param name="monster"></param>
    /// <param name="skill"></param>
    public void SetSkillHighlight(BattleMapMonster monster, MonsterSkill skill)
    {
        // いったん全部ハイライトを解除
        skillSelectObject.SkillButtonGameObjectList.ForEach(
            skillGo => skillGo.GetComponent <Animator>().SetBool("Highlight", false));

        // 対象をハイライト
        skillSelectObject.GetSkillButtonGameObject(skill).GetComponent <Animator>().SetBool("Highlight", true);

        // オーバービューを設定
        skillSelectObject.OverviewText.text = skill.Overview;
    }
 private void Control_KeyDown(object sender, KeyEventArgs e)
 {
     if ((e.KeyData == Keys.F12) &&
         (dataGridView.CurrentCell is DataGridViewComboBoxCell) &&
         (dataGridView.CurrentRow.DataBoundItem is MonsterSkill))
     {
         MonsterSkill skill = dataGridView.CurrentRow.DataBoundItem as MonsterSkill;
         DataGridViewComboBoxEditingControl c = dataGridView.EditingControl as DataGridViewComboBoxEditingControl;
         c.SelectedItem = ReflectionHelpers.GetFieldOrProperty <Ability>(skill.Default, dataGridView.Columns[dataGridView.CurrentCell.ColumnIndex].DataPropertyName);
         dataGridView.EndEdit();
     }
 }
예제 #9
0
        private void monsterSkillbmdToolStripMenuItem2_Click(object sender, EventArgs e)
        {
            string fpath = OpenDialog();

            if (string.IsNullOrEmpty(fpath))
            {
                return;
            }

            MonsterSkill Decoder = new MonsterSkill(fpath, BmdFile.FileType.MonsterSkill);
            ClientEditor editor  = new ClientEditor(Decoder, false);

            editor.Show();
        }
 private void dataGridView_CellToolTipTextNeeded(object sender, DataGridViewCellToolTipTextNeededEventArgs e)
 {
     if ((e.RowIndex >= 0) && (e.ColumnIndex >= 0) &&
         (dataGridView[e.ColumnIndex, e.RowIndex] is DataGridViewComboBoxCell) &&
         (dataGridView.Rows[e.RowIndex].DataBoundItem is MonsterSkill))
     {
         MonsterSkill skill = dataGridView.Rows[e.RowIndex].DataBoundItem as MonsterSkill;
         if (skill.Default != null)
         {
             Ability a = ReflectionHelpers.GetFieldOrProperty <Ability>(skill.Default, dataGridView.Columns[e.ColumnIndex].DataPropertyName);
             e.ToolTipText = "Default: " + a.ToString();
         }
     }
 }
    /// <summary>
    /// 相手選択の解除
    /// </summary>
    public void CancelOpponentSelect()
    {
        // 相手のステータスを隠す
        statusGenerator.HideStatusReserve();

        BattleMapActionStatus actionStatus = holder.BattleMapStatus.BattleMapActionStatus;
        BattleMapMonster      monster      = actionStatus.TargetMonster;
        MonsterSkill          skill        = actionStatus.SelectedSkill;

        // ステータスを表示
        statusGenerator.ShowStatus(monster, BattleMapStatusPanelType.SKILL1);
        statusGenerator.SetSkill(skill);

        // ステータスの更新
        actionStatus.BattleMapActionStatusType = BattleMapActionStatusType.BEFORE_OPPONENT_SELECT;
        actionStatus.OpponentMonster           = null;
    }
예제 #12
0
        private static void Main(string[] args)
        {
            Monster monster = new Monster()
            {
                monstername = "妙蛙種子",
                gender      = true,
                property    = "草/毒",
                hp          = 60,
                weight      = 5.94f,
                height      = 0.67f,
                star        = 271484,
                candy       = 27,
            };

            MonsterSkill monsterskill = new MonsterSkill()
            {
                skillname   = "藤鞭",
                skillrank   = 0,
                skillinjure = 7
            };

            MonsterSkill monsterskill2 = new MonsterSkill()
            {
                skillname   = "汙泥炸彈",
                skillrank   = 2,
                skillinjure = 80
            };

            Console.WriteLine(
                "{0},{1}HP,{2}kg,屬性{3},{4}m,{5}星星沙子,{6}{0}的糖果,{7},{8},{9},{10},{11},{12}",
                monster.monstername,
                monster.hp,
                monster.weight,
                monster.property,
                monster.height,
                monster.star,
                monster.candy,
                monsterskill.skillname,
                monsterskill.skillrank,
                monsterskill.skillinjure,
                monsterskill2.skillname,
                monsterskill2.skillrank,
                monsterskill2.skillinjure);
        }
예제 #13
0
        private void CheckMonster(MonsterCard monsterCard, ref string effectPath)
        {
            var monsterConfig = monsterCard.GetMonster().MonsterConfig;

            foreach (var skill in MonsterBook.GetSkillList(monsterConfig.Id))
            {
                int          skillId      = skill.Id;
                MonsterSkill monsterSkill = new MonsterSkill(skillId, skill.Value, 0);
                skills.Add(monsterSkill);
                SkillConfig skillConfig = ConfigData.GetSkillConfig(skillId);
                if (!string.IsNullOrEmpty(skillConfig.Cover))
                {
                    effectPath = skillConfig.Cover;
                }
            }
            if (monsterConfig.Cover != "")
            {
                effectPath = monsterConfig.Cover;
            }
        }
    /// <summary>
    /// スキルを選択
    /// </summary>
    /// <param name="skill"></param>
    public void SelectSkill(MonsterSkill skill)
    {
        BattleMapActionStatus actionStatus = holder.BattleMapStatus.BattleMapActionStatus;

        // スキル選択前、もしくは選択されたスキルが異なる場合
        if (actionStatus.BattleMapActionStatusType == BattleMapActionStatusType.BEFORE_SKILL_SELECT ||
            actionStatus.SelectedSkill != skill)
        {
            // スキルの確認
            BattleMapMonster monster = actionStatus.TargetMonster;
            skillSelectGenerator.ConfirmSkill(monster, skill);

            // ステータスの更新
            actionStatus.SelectedSkill             = skill;
            actionStatus.BattleMapActionStatusType = BattleMapActionStatusType.CONFIRM_SKILL_SELECT;
        }

        // スキル確認中、かつ選択されたスキルが同じ場合
        else if (actionStatus.BattleMapActionStatusType == BattleMapActionStatusType.CONFIRM_SKILL_SELECT &&
                 actionStatus.SelectedSkill == skill)
        {
            // スキルを非表示
            skillSelectGenerator.HideSkillSelect();

            // スキル範囲の描画
            BattleMapMonster monster = actionStatus.TargetMonster;
            DrawRange(skill, monster);

            // ステータスを表示
            statusGenerator.ShowStatus(monster, BattleMapStatusPanelType.SKILL1);
            statusGenerator.SetSkill(skill);

            // ステータスの更新
            actionStatus.BattleMapActionStatusType = BattleMapActionStatusType.BEFORE_OPPONENT_SELECT;
        }

        // TODO: ここに来ることはない?
        else
        {
        }
    }
    /// <summary>
    /// スキルを設定
    /// </summary>
    /// <param name="skill"></param>
    public void SetSkill(MonsterSkill skill)
    {
        // 反撃時、スキルがなければ終了
        if (skill == null)
        {
            spObject.SkillButton.SetActive(false);
            spObject.OverviewText.text = "";
            return;
        }

        else
        {
            spObject.SkillButton.SetActive(true);

            spObject.SkillText.GetComponent <Text>().text = skill.Name;
            spObject.OverviewText.text = skill.Overview;

            // 背景色の入れ替え
            SetSkillColorImage(skill);
        }
    }
예제 #16
0
 public _0024Start_0024188(MonsterSkill self_)
 {
     _0024self__0024190 = self_;
 }
예제 #17
0
    public override void Init()
    {
        self = GetComponent <MonsterFightUnit>();
        self.OnNoramlAttackFinish += ThinkUseSkill;
        /*普通攻击初始化*/
        normalAttack        = NGUITools.AddChild <NormalAttack>(gameObject);
        normalAttack.attack = Util.GetDic <MsgAttackData, AttackData>()[normalAttackId];
        JsonData castEffectDt = JsonMapper.ToObject(Util.GetConfigString(normalAttack.attack.castEffect));

        for (int i = 0; i < castEffectDt.Count; i++)
        {
            normalAttack.castEffectIds.Add((int)castEffectDt[i]);
        }
        JsonData flyEffectDt = JsonMapper.ToObject(Util.GetConfigString(normalAttack.attack.flyEffect));

        for (int i = 0; i < flyEffectDt.Count; i++)
        {
            normalAttack.flyEffectIds.Add((int)flyEffectDt[i]);
        }
        JsonData hitEffectDt = JsonMapper.ToObject(Util.GetConfigString(normalAttack.attack.hitEffect));

        for (int i = 0; i < hitEffectDt.Count; i++)
        {
            normalAttack.hitEffectIds.Add((int)hitEffectDt[i]);
        }
        normalAttack.mineUnit = self;
        normalAttack.Init();
        /*主动技能初始化*/
        foreach (int normalSkillId in autoSkillsId)
        {
            ActiveSkill normalSkill = NGUITools.AddChild <ActiveSkill>(gameObject);
            normalSkill.normalSkill  = Util.GetDic <MsgNormalSkill, NormalSkill>()[normalSkillId];
            normalSkill.dmgEffectId  = (int)normalSkill.normalSkill.dmgEffect;
            normalSkill.castEffectId = (int)normalSkill.normalSkill.castEffect;
            normalSkill.flyEffectId  = (int)normalSkill.normalSkill.flyEffect;
            normalSkill.hitEffectId  = (int)normalSkill.normalSkill.hitEffect;
            normalSkill.mineUnit     = self;
            int LvUpId = normalSkillId * 100 + 1;
            normalSkill.normalSkillLvUp = Util.GetDic <MsgNormalSkillLvUp, NormalSkillLvUp>()[LvUpId];
            normalSkill.Init();
            MonsterSkill skillCondition = null;
            Util.GetDic <MsgMonsterSkill, MonsterSkill>().TryGetValue(normalSkillId, out skillCondition);
            SkillCondition condition    = SkillCondition.None;
            int            conditionVal = 0;
            float          minCd        = 0;
            float          maxCd        = 0;
            if (skillCondition != null)
            {
                JsonData dt = JsonMapper.ToObject(Util.GetConfigString(skillCondition.condition));
                if (dt.Count == 2)
                {
                    condition    = (SkillCondition)int.Parse(dt[0].ToString());
                    conditionVal = int.Parse(dt[1].ToString());
                }
                JsonData dt_1 = JsonMapper.ToObject(Util.GetConfigString(skillCondition.interval));
                minCd = float.Parse(dt_1[0].ToString());
                maxCd = float.Parse(dt_1[1].ToString());
            }
            ActiveSkillStruct activeSkillStruct = new ActiveSkillStruct();
            activeSkillStruct.autoSkill          = normalSkill;
            activeSkillStruct.autoSkillCondition = skillCondition;
            activeSkillStruct.condition          = condition;
            activeSkillStruct.conditionVal       = conditionVal;
            activeSkillStruct.minCd = minCd;
            activeSkillStruct.maxCd = maxCd;
            autoSkills.Add(activeSkillStruct);
        }
        enabled = false;
    }
예제 #18
0
        public void refresh(string fielpath)
        {
            if (fielpath.Length != 0)
            {
                //WWW www = new WWW(fielpath);
                //yield return www;

                //MemoryStream ms = new MemoryStream(www.bytes);
                TextAsset    txt = Resources.Load(fielpath) as TextAsset;
                MemoryStream ms  = new MemoryStream(txt.bytes);

                StructArry pbi     = Serializer.DeserializeWithLengthPrefix <StructArry>(ms, PrefixStyle.None);
                Type       type    = pbi.GetType();
                string     strname = type.Name;
                switch (strname)
                {
                case "MsgAttackData":
                    MsgAttackData struct1 = pbi as MsgAttackData;
                    DataPool = struct1.struct_data as List <Struct>;
                    for (int i = 0; i < DataPool.Count; i++)
                    {
                        AttackData dt = DataPool[i] as AttackData;
                        DataStore.Add((int)dt.id, DataPool[i]);
                    }
                    break;

                case "MsgAwakeningSkill":
                    MsgAwakeningSkill struct2 = pbi as MsgAwakeningSkill;
                    DataPool = struct2.struct_data as List <Struct>;
                    for (int i = 0; i < DataPool.Count; i++)
                    {
                        AwakeningSkill dt = DataPool[i] as AwakeningSkill;
                        DataStore.Add((int)dt.id, DataPool[i]);
                    }
                    break;

                case "MsgAwakeningSkillLevel":
                    MsgAwakeningSkillLevel struct3 = pbi as MsgAwakeningSkillLevel;
                    DataPool = struct3.struct_data as List <Struct>;
                    for (int i = 0; i < DataPool.Count; i++)
                    {
                        AwakeningSkillLevel dt = DataPool[i] as AwakeningSkillLevel;
                        DataStore.Add((int)dt.id, DataPool[i]);
                    }
                    break;

                case "MsgElementFactor":
                    MsgElementFactor struct4 = pbi as MsgElementFactor;
                    DataPool = struct4.struct_data as List <Struct>;
                    for (int i = 0; i < DataPool.Count; i++)
                    {
                        ElementFactor dt = DataPool[i] as ElementFactor;
                        DataStore.Add((int)dt.id, DataPool[i]);
                    }
                    break;

                case "MsgBuffData":
                    MsgBuffData struct5 = pbi as MsgBuffData;
                    DataPool = struct5.struct_data as List <Struct>;
                    for (int i = 0; i < DataPool.Count; i++)
                    {
                        BuffData dt = DataPool[i] as BuffData;
                        DataStore.Add((int)dt.id, DataPool[i]);
                    }
                    break;

                case "MsgCombinationData":
                    MsgCombinationData struct6 = pbi as MsgCombinationData;
                    DataPool = struct6.struct_data as List <Struct>;
                    for (int i = 0; i < DataPool.Count; i++)
                    {
                        CombinationData dt = DataPool[i] as CombinationData;
                        DataStore.Add((int)dt.id, DataPool[i]);
                    }
                    break;

                case "MsgConstData":
                    MsgConstData struct7 = pbi as MsgConstData;
                    DataPool = struct7.struct_data as List <Struct>;
                    for (int i = 0; i < DataPool.Count; i++)
                    {
                        ConstData dt = DataPool[i] as ConstData;
                        DataStore.Add((int)dt.id, DataPool[i]);
                    }
                    break;

                case "MsgCurrency":
                    MsgCurrency struct8 = pbi as MsgCurrency;
                    DataPool = struct8.struct_data as List <Struct>;
                    for (int i = 0; i < DataPool.Count; i++)
                    {
                        Currency dt = DataPool[i] as Currency;
                        DataStore.Add((int)dt.id, DataPool[i]);
                    }
                    break;

                case "MsgDungeon":
                    MsgDungeon struct9 = pbi as MsgDungeon;
                    DataPool = struct9.struct_data as List <Struct>;
                    for (int i = 0; i < DataPool.Count; i++)
                    {
                        Dungeon dt = DataPool[i] as Dungeon;
                        DataStore.Add((int)dt.id, DataPool[i]);
                    }
                    break;

                case "MsgEnemyData":
                    MsgEnemyData struct10 = pbi as MsgEnemyData;
                    DataPool = struct10.struct_data as List <Struct>;
                    for (int i = 0; i < DataPool.Count; i++)
                    {
                        EnemyData dt = DataPool[i] as EnemyData;
                        DataStore.Add((int)dt.id, DataPool[i]);
                    }
                    break;

                case "MsgEvaluateBonus":
                    MsgEvaluateBonus struct11 = pbi as MsgEvaluateBonus;
                    DataPool = struct11.struct_data as List <Struct>;
                    for (int i = 0; i < DataPool.Count; i++)
                    {
                        EvaluateBonus dt = DataPool[i] as EvaluateBonus;
                        DataStore.Add((int)dt.id, DataPool[i]);
                    }
                    break;

                case "MsgFieldEffect":
                    MsgFieldEffect struct12 = pbi as MsgFieldEffect;
                    DataPool = struct12.struct_data as List <Struct>;
                    for (int i = 0; i < DataPool.Count; i++)
                    {
                        FieldEffect dt = DataPool[i] as FieldEffect;
                        DataStore.Add((int)dt.id, DataPool[i]);
                    }
                    break;

                case "MsgHeroData":
                    MsgHeroData struct13 = pbi as MsgHeroData;
                    DataPool = struct13.struct_data as List <Struct>;
                    for (int i = 0; i < DataPool.Count; i++)
                    {
                        HeroData dt = DataPool[i] as HeroData;
                        DataStore.Add((int)dt.id, DataPool[i]);
                    }
                    break;

                case "MsgHeroLvData":
                    MsgHeroLvData struct14 = pbi as MsgHeroLvData;
                    DataPool = struct14.struct_data as List <Struct>;
                    for (int i = 0; i < DataPool.Count; i++)
                    {
                        HeroLvData dt = DataPool[i] as HeroLvData;
                        DataStore.Add((int)dt.level, DataPool[i]);
                    }
                    break;

                case "MsgHeroEvolution":
                    MsgHeroEvolution struct15 = pbi as MsgHeroEvolution;
                    DataPool = struct15.struct_data as List <Struct>;
                    for (int i = 0; i < DataPool.Count; i++)
                    {
                        HeroEvolution dt = DataPool[i] as HeroEvolution;
                        DataStore.Add((int)dt.id, DataPool[i]);
                    }
                    break;

                case "MsgPotentialData":
                    MsgPotentialData struct16 = pbi as MsgPotentialData;
                    DataPool = struct16.struct_data as List <Struct>;
                    for (int i = 0; i < DataPool.Count; i++)
                    {
                        PotentialData dt = DataPool[i] as PotentialData;
                        DataStore.Add((int)dt.element, DataPool[i]);
                    }
                    break;

                case "MsgItemData":
                    MsgItemData struct17 = pbi as MsgItemData;
                    DataPool = struct17.struct_data as List <Struct>;
                    for (int i = 0; i < DataPool.Count; i++)
                    {
                        ItemData dt = DataPool[i] as ItemData;
                        DataStore.Add((int)dt.id, DataPool[i]);
                    }
                    break;

                case "MsgLeaderSkill":
                    MsgLeaderSkill struct18 = pbi as MsgLeaderSkill;
                    DataPool = struct18.struct_data as List <Struct>;
                    for (int i = 0; i < DataPool.Count; i++)
                    {
                        LeaderSkill dt = DataPool[i] as LeaderSkill;
                        DataStore.Add((int)dt.id, DataPool[i]);
                    }
                    break;

                case "MsgMonsterData":
                    MsgMonsterData struct19 = pbi as MsgMonsterData;
                    DataPool = struct19.struct_data as List <Struct>;
                    for (int i = 0; i < DataPool.Count; i++)
                    {
                        MonsterData dt = DataPool[i] as MonsterData;
                        DataStore.Add((int)dt.id, DataPool[i]);
                    }
                    break;

                case "MsgMonsterSkill":
                    MsgMonsterSkill struct20 = pbi as MsgMonsterSkill;
                    DataPool = struct20.struct_data as List <Struct>;
                    for (int i = 0; i < DataPool.Count; i++)
                    {
                        MonsterSkill dt = DataPool[i] as MonsterSkill;
                        DataStore.Add((int)dt.id, DataPool[i]);
                    }
                    break;

                case "MsgNormalSkill":
                    MsgNormalSkill struct21 = pbi as MsgNormalSkill;
                    DataPool = struct21.struct_data as List <Struct>;
                    for (int i = 0; i < DataPool.Count; i++)
                    {
                        NormalSkill dt = DataPool[i] as NormalSkill;
                        DataStore.Add((int)dt.id, DataPool[i]);
                    }
                    break;

                case "MsgNormalSkillLvUp":
                    MsgNormalSkillLvUp struct22 = pbi as MsgNormalSkillLvUp;
                    DataPool = struct22.struct_data as List <Struct>;
                    for (int i = 0; i < DataPool.Count; i++)
                    {
                        NormalSkillLvUp dt = DataPool[i] as NormalSkillLvUp;
                        DataStore.Add((int)dt.id, DataPool[i]);
                    }
                    break;

                case "MsgRoleData":
                    MsgRoleData struct23 = pbi as MsgRoleData;
                    DataPool = struct23.struct_data as List <Struct>;
                    for (int i = 0; i < DataPool.Count; i++)
                    {
                        RoleData dt = DataPool[i] as RoleData;
                        DataStore.Add((int)dt.level, DataPool[i]);
                    }
                    break;

                case "MsgRuneData":
                    MsgRuneData struct24 = pbi as MsgRuneData;
                    DataPool = struct24.struct_data as List <Struct>;
                    for (int i = 0; i < DataPool.Count; i++)
                    {
                        RuneData dt = DataPool[i] as RuneData;
                        DataStore.Add((int)dt.id, DataPool[i]);
                    }
                    break;

                case "MsgRuneSet":
                    MsgRuneSet struct25 = pbi as MsgRuneSet;
                    DataPool = struct25.struct_data as List <Struct>;
                    for (int i = 0; i < DataPool.Count; i++)
                    {
                        RuneSet dt = DataPool[i] as RuneSet;
                        DataStore.Add((int)dt.id, DataPool[i]);
                    }
                    break;

                case "MsgRuneEnhance":
                    MsgRuneEnhance struct26 = pbi as MsgRuneEnhance;
                    DataPool = struct26.struct_data as List <Struct>;
                    for (int i = 0; i < DataPool.Count; i++)
                    {
                        RuneEnhance dt = DataPool[i] as RuneEnhance;
                        DataStore.Add((int)dt.level, DataPool[i]);
                    }
                    break;

                case "MsgRuneSynchro":
                    MsgRuneSynchro struct27 = pbi as MsgRuneSynchro;
                    DataPool = struct27.struct_data as List <Struct>;
                    for (int i = 0; i < DataPool.Count; i++)
                    {
                        RuneSynchro dt = DataPool[i] as RuneSynchro;
                        DataStore.Add((int)dt.id, DataPool[i]);
                    }
                    break;

                case "MsgSpecialSkill":
                    MsgSpecialSkill struct28 = pbi as MsgSpecialSkill;
                    DataPool = struct28.struct_data as List <Struct>;
                    for (int i = 0; i < DataPool.Count; i++)
                    {
                        SpecialSkill dt = DataPool[i] as SpecialSkill;
                        DataStore.Add((int)dt.id, DataPool[i]);
                    }
                    break;

                case "MsgSpecialSkillLvUp":
                    MsgSpecialSkillLvUp struct29 = pbi as MsgSpecialSkillLvUp;
                    DataPool = struct29.struct_data as List <Struct>;
                    for (int i = 0; i < DataPool.Count; i++)
                    {
                        SpecialSkillLvUp dt = DataPool[i] as SpecialSkillLvUp;
                        DataStore.Add((int)dt.id, DataPool[i]);
                    }
                    break;

                case "MsgDecisionFactor":
                    MsgDecisionFactor struct30 = pbi as MsgDecisionFactor;
                    DataPool = struct30.struct_data as List <Struct>;
                    for (int i = 0; i < DataPool.Count; i++)
                    {
                        DecisionFactor dt = DataPool[i] as DecisionFactor;
                        DataStore.Add((int)dt.id, DataPool[i]);
                    }
                    break;

                case "MsgTaskData":
                    MsgTaskData struct31 = pbi as MsgTaskData;
                    DataPool = struct31.struct_data as List <Struct>;
                    for (int i = 0; i < DataPool.Count; i++)
                    {
                        TaskData dt = DataPool[i] as TaskData;
                        DataStore.Add((int)dt.id, DataPool[i]);
                    }
                    break;

                case "MsgHeroText":
                    MsgHeroText struct32 = pbi as MsgHeroText;
                    DataPool = struct32.struct_data as List <Struct>;
                    for (int i = 0; i < DataPool.Count; i++)
                    {
                        HeroText dt = DataPool[i] as HeroText;
                        Util.TextDic.Add(Util.GetConfigString(dt.name), Util.GetConfigString(dt.textDes));
                    }
                    break;

                case "MsgDungeonText":
                    MsgDungeonText struct33 = pbi as MsgDungeonText;
                    DataPool = struct33.struct_data as List <Struct>;
                    for (int i = 0; i < DataPool.Count; i++)
                    {
                        DungeonText dt = DataPool[i] as DungeonText;
                        Util.TextDic.Add(Util.GetConfigString(dt.name), Util.GetConfigString(dt.textDes));
                    }
                    break;

                case "MsgMonsterText":
                    MsgMonsterText struct34 = pbi as MsgMonsterText;
                    DataPool = struct34.struct_data as List <Struct>;
                    for (int i = 0; i < DataPool.Count; i++)
                    {
                        MonsterText dt = DataPool[i] as MonsterText;
                        Util.TextDic.Add(Util.GetConfigString(dt.name), Util.GetConfigString(dt.textDes));
                    }
                    break;

                case "MsgFieldText":
                    MsgFieldText struct35 = pbi as MsgFieldText;
                    DataPool = struct35.struct_data as List <Struct>;
                    for (int i = 0; i < DataPool.Count; i++)
                    {
                        FieldText dt = DataPool[i] as FieldText;
                        Util.TextDic.Add(Util.GetConfigString(dt.name), Util.GetConfigString(dt.textDes));
                    }
                    break;

                case "MsgCombinationText":
                    MsgCombinationText struct36 = pbi as MsgCombinationText;
                    DataPool = struct36.struct_data as List <Struct>;
                    for (int i = 0; i < DataPool.Count; i++)
                    {
                        CombinationText dt = DataPool[i] as CombinationText;
                        Util.TextDic.Add(Util.GetConfigString(dt.name), Util.GetConfigString(dt.textDes));
                    }
                    break;

                case "MsgSkillText":
                    MsgSkillText struct37 = pbi as MsgSkillText;
                    DataPool = struct37.struct_data as List <Struct>;
                    for (int i = 0; i < DataPool.Count; i++)
                    {
                        SkillText dt = DataPool[i] as SkillText;
                        Util.TextDic.Add(Util.GetConfigString(dt.name), Util.GetConfigString(dt.textDes));
                    }
                    break;

                case "MsgCurrencyText":
                    MsgCurrencyText struct38 = pbi as MsgCurrencyText;
                    DataPool = struct38.struct_data as List <Struct>;
                    for (int i = 0; i < DataPool.Count; i++)
                    {
                        CurrencyText dt = DataPool[i] as CurrencyText;
                        Util.TextDic.Add(Util.GetConfigString(dt.name), Util.GetConfigString(dt.textDes));
                    }
                    break;

                case "MsgBuffText":
                    MsgBuffText struct39 = pbi as MsgBuffText;
                    DataPool = struct39.struct_data as List <Struct>;
                    for (int i = 0; i < DataPool.Count; i++)
                    {
                        BuffText dt = DataPool[i] as BuffText;
                        Util.TextDic.Add(Util.GetConfigString(dt.name), Util.GetConfigString(dt.textDes));
                    }
                    break;

                case "MsgItemText":
                    MsgItemText struct40 = pbi as MsgItemText;
                    DataPool = struct40.struct_data as List <Struct>;
                    for (int i = 0; i < DataPool.Count; i++)
                    {
                        ItemText dt = DataPool[i] as ItemText;
                        Util.TextDic.Add(Util.GetConfigString(dt.name), Util.GetConfigString(dt.textDes));
                    }
                    break;

                case "MsgRuneText":
                    MsgRuneText struct41 = pbi as MsgRuneText;
                    DataPool = struct41.struct_data as List <Struct>;
                    for (int i = 0; i < DataPool.Count; i++)
                    {
                        RuneText dt = DataPool[i] as RuneText;
                        Util.TextDic.Add(Util.GetConfigString(dt.name), Util.GetConfigString(dt.textDes));
                    }
                    break;

                case "MsgTaskText":
                    MsgTaskText struct42 = pbi as MsgTaskText;
                    DataPool = struct42.struct_data as List <Struct>;
                    for (int i = 0; i < DataPool.Count; i++)
                    {
                        TaskText dt = DataPool[i] as TaskText;
                        Util.TextDic.Add(Util.GetConfigString(dt.name), Util.GetConfigString(dt.textDes));
                    }
                    break;

                case "MsgWorldData":
                    MsgWorldData struct43 = pbi as MsgWorldData;
                    DataPool = struct43.struct_data as List <Struct>;
                    for (int i = 0; i < DataPool.Count; i++)
                    {
                        WorldData dt = DataPool[i] as WorldData;
                        DataStore.Add((int)dt.id, DataPool[i]);
                    }
                    break;

                case "MsgAirRaidData":
                    MsgAirRaidData struct44 = pbi as MsgAirRaidData;
                    DataPool = struct44.struct_data as List <Struct>;
                    for (int i = 0; i < DataPool.Count; i++)
                    {
                        AirRaidData dt = DataPool[i] as AirRaidData;
                        DataStore.Add((int)dt.id, DataPool[i]);
                    }
                    break;

                case "MsgTalentData":
                    MsgTalentData struct45 = pbi as MsgTalentData;
                    DataPool = struct45.struct_data as List <Struct>;
                    for (int i = 0; i < DataPool.Count; i++)
                    {
                        TalentData dt = DataPool[i] as TalentData;
                        DataStore.Add((int)dt.id, DataPool[i]);
                    }
                    break;

                case "MsgSummonData":
                    MsgSummonData struct46 = pbi as MsgSummonData;
                    DataPool = struct46.struct_data as List <Struct>;
                    for (int i = 0; i < DataPool.Count; i++)
                    {
                        SummonData dt = DataPool[i] as SummonData;
                        DataStore.Add((int)dt.id, DataPool[i]);
                    }
                    break;

                case "MsgSummonPrize":
                    MsgSummonPrize struct47 = pbi as MsgSummonPrize;
                    DataPool = struct47.struct_data as List <Struct>;
                    for (int i = 0; i < DataPool.Count; i++)
                    {
                        SummonPrize dt = DataPool[i] as SummonPrize;
                        DataStore.Add((int)dt.id, DataPool[i]);
                    }
                    break;

                case "MsgStarWeight":
                    MsgStarWeight struct48 = pbi as MsgStarWeight;
                    DataPool = struct48.struct_data as List <Struct>;
                    for (int i = 0; i < DataPool.Count; i++)
                    {
                        StarWeight dt = DataPool[i] as StarWeight;
                        DataStore.Add((int)dt.id, DataPool[i]);
                    }
                    break;

                case "MsgSpecialEffect":
                    MsgSpecialEffect struct49 = pbi as MsgSpecialEffect;
                    DataPool = struct49.struct_data as List <Struct>;
                    for (int i = 0; i < DataPool.Count; i++)
                    {
                        SpecialEffect dt = DataPool[i] as SpecialEffect;
                        DataStore.Add((int)dt.id, DataPool[i]);
                    }
                    break;

                case "MsgFlyingEffect":
                    MsgFlyingEffect struct50 = pbi as MsgFlyingEffect;
                    DataPool = struct50.struct_data as List <Struct>;
                    for (int i = 0; i < DataPool.Count; i++)
                    {
                        FlyingEffect dt = DataPool[i] as FlyingEffect;
                        DataStore.Add((int)dt.id, DataPool[i]);
                    }
                    break;

                case "MsgDistanceFactor":
                    MsgDistanceFactor struct51 = pbi as MsgDistanceFactor;
                    DataPool = struct51.struct_data as List <Struct>;
                    for (int i = 0; i < DataPool.Count; i++)
                    {
                        DistanceFactor dt = DataPool[i] as DistanceFactor;
                        DataStore.Add((int)dt.id, DataPool[i]);
                    }
                    break;

                case "MsgEvaluateData":
                    MsgEvaluateData struct52 = pbi as MsgEvaluateData;
                    DataPool = struct52.struct_data as List <Struct>;
                    for (int i = 0; i < DataPool.Count; i++)
                    {
                        EvaluateData dt = DataPool[i] as EvaluateData;
                        DataStore.Add((int)dt.id, DataPool[i]);
                    }
                    break;

                case "MsgPromptText":
                    MsgPromptText struct53 = pbi as MsgPromptText;
                    DataPool = struct53.struct_data as List <Struct>;
                    for (int i = 0; i < DataPool.Count; i++)
                    {
                        PromptText dt = DataPool[i] as PromptText;
                        Util.TextDic.Add(Util.GetConfigString(dt.name), Util.GetConfigString(dt.textDes));
                    }
                    break;

                case "MsgStoryText":
                    MsgStoryText struct54 = pbi as MsgStoryText;
                    DataPool = struct54.struct_data as List <Struct>;
                    for (int i = 0; i < DataPool.Count; i++)
                    {
                        StoryText dt = DataPool[i] as StoryText;
                        Util.TextDic.Add(Util.GetConfigString(dt.name), Util.GetConfigString(dt.textDes));
                    }
                    break;
                }
            }
        }
예제 #19
0
        public static void Load()
        {
            if (Loaded == true || Loading == true)
            {
                return;
            }

            Loading = true;
            // Trigger events for scripts
            Events.InvokeWorldLoadStart();

            // Our object manager for databsae objects
            Database = new DatabaseObjectManager();
            // Our object manager for world objects (spawned objects)
            Objects = new WorldObjectManager();

            // Delegate for Send() Method
            mForeachInRangeCallback = new ForeachInRangeVoidDelegate(SendSub);

            mAddQueue = new Queue <DatabaseObject>();
            mDelQueue = new Queue <DatabaseObject>();

            // Load globals from config, initialize packets ect
            ServerConsole.InfoLine("Initialize game symantics...");
            Global.Initialize();
            WorldObjectStatus.Initialize();
            ChatHelper.Initialize();
            PlayerCommandHelper.Initialize();
            PathHelper.Initialize();
            SkillTree.Initialize();
            FameListHelper.Initialize();
            CharacterJobBonus.Initialize();
            CharacterJobModifer.Initialize();

            // Real database loading
            ServerConsole.InfoLine("Begin World loading...");

            DataTable table    = null;
            Stopwatch watchAll = Stopwatch.StartNew();
            Stopwatch watch    = Stopwatch.StartNew();

            //------------- loading start -------------

            #region Mapcache
            ServerConsole.Info("\t# loading Maps from mapcache...");
            watch.Reset();
            watch.Start();
            Mapcache.Initialize();
            watch.Stop();
            ServerConsole.WriteLine(EConsoleColor.Status, " done (" + Mapcache.Maps.Count + " Maps in " + watch.ElapsedMilliseconds + "ms)");
            #endregion


            #region Items
            ServerConsole.Info("\t# loading Items...");
            watch.Reset();
            watch.Start();
            table           = Core.Database.Query("SELECT * FROM dbitem");
            table.TableName = "ItemDB Table";


            if (table == null || table.Rows.Count == 0)
            {
                if (Core.Database.LastError != null)
                {
                    ServerConsole.ErrorLine("failed to load Item Database!");
                    ServerConsole.WriteLine(Core.Database.LastError.ToString());
                }
            }
            else
            {
                ItemDatabaseData item;
                for (int i = 0; i < table.Rows.Count; i++)
                {
                    item = ItemDatabaseData.Load(table.Rows[i]);
                    if (item == null)
                    {
                        ServerConsole.WarningLine("Failed to load item {0}: #{1} {2}", i, table.Rows[i].Field <int>("itemID"), table.Rows[i].Field <string>("nameEnglish"));
                        continue;
                    }
                    Database.Add(item);

                    //ServerConsole.DebugLine("\tLoad: #{0} {1}", item.NameID.ToString().PadLeft(5), item.Name);
                }
            }
            watch.Stop();
            ServerConsole.WriteLine(EConsoleColor.Status, " done (" + Database.Items.Count + " Items in " + watch.ElapsedMilliseconds + "ms)");
            #endregion


            #region Monster
            ServerConsole.Info("\t# loading Mobs...");
            watch.Reset();
            watch.Start();
            table           = Core.Database.Query("SELECT * FROM dbmob");
            table.TableName = "MobDB Table";
            if (table == null || table.Rows.Count == 0)
            {
                if (Core.Database.LastError != null)
                {
                    ServerConsole.ErrorLine("failed to load Monster Database!");
                    ServerConsole.WriteLine(Core.Database.LastError.ToString());
                }
            }
            else
            {
                MonsterDatabaseData mob;
                for (int i = 0; i < table.Rows.Count; i++)
                {
                    mob = MonsterDatabaseData.Load(table.Rows[i]);
                    if (mob == null)
                    {
                        ServerConsole.WarningLine("Failed to load mob {0}: #{1} {2}", i, table.Rows[i].Field <int>("mobID"), table.Rows[i].Field <string>("nameInter"));
                        continue;
                    }
                    Database.Add(mob);

                    //ServerConsole.DebugLine("\tLoad: #{0} {1} ({2} drops, {3} skills)", mob.ID.ToString().PadLeft(5), mob.NameInter, mob.Drops.Count, mob.Skills.Count);
                }
            }
            watch.Stop();
            ServerConsole.WriteLine(EConsoleColor.Status, " done (" + Database.Monster.Count + " Mobs in " + watch.ElapsedMilliseconds + "ms)");


            ServerConsole.Info("\t# loading Mob Skills...");
            watch.Reset();
            watch.Start();
            table           = Core.Database.Query("SELECT * FROM dbmob_skill ORDER BY mobID ASC");
            table.TableName = "MobDB Skill Table";
            if (table == null || table.Rows.Count == 0)
            {
                if (Core.Database.LastError != null)
                {
                    ServerConsole.ErrorLine("failed to load Mob Skill Database!");
                    ServerConsole.WriteLine(Core.Database.LastError.ToString());
                }
            }
            else
            {
                MonsterSkill mobSkill;
                for (int i = 0; i < table.Rows.Count; i++)
                {
                    mobSkill = MonsterSkill.Load(table.Rows[i]);
                    if (mobSkill == null)
                    {
                        throw new Exception(string.Format("Failed to load mob skill #{0}: {1}", table.Rows[i].Field <int>("mobID"), table.Rows[i].Field <string>("info")));
                    }

                    (Database[EDatabaseType.Mob, mobSkill.MobID] as MonsterDatabaseData).Skills.Add(mobSkill);

                    //ServerConsole.DebugLine("\tLoad: #{0} {1} ({2} level)", skill.ID.ToString().PadLeft(5), skill.Name, skill.Level.Count);
                }
            }
            watch.Stop();
            ServerConsole.WriteLine(EConsoleColor.Status, " done in " + watch.ElapsedMilliseconds + "ms");


            ServerConsole.Info("\t# loading Mob Drops...");
            watch.Reset();
            watch.Start();
            table           = Core.Database.Query("SELECT * FROM dbmob_drop ORDER BY mobID ASC");
            table.TableName = "MobDB Drop Table";
            if (table == null || table.Rows.Count == 0)
            {
                if (Core.Database.LastError != null)
                {
                    ServerConsole.ErrorLine("failed to load Mob Drop Database!");
                    ServerConsole.WriteLine(Core.Database.LastError.ToString());
                }
            }
            else
            {
                MonsterDrop drop;
                for (int i = 0; i < table.Rows.Count; i++)
                {
                    drop = MonsterDrop.Load(table.Rows[i]);

                    (Database[EDatabaseType.Mob, drop.MobID] as MonsterDatabaseData).Drops.Add(drop);

                    //ServerConsole.DebugLine("\tLoad: #{0} {1} ({2} level)", skill.ID.ToString().PadLeft(5), skill.Name, skill.Level.Count);
                }
            }
            watch.Stop();
            ServerConsole.WriteLine(EConsoleColor.Status, " done in " + watch.ElapsedMilliseconds + "ms");
            #endregion


            #region General Skills
            ServerConsole.Info("\t# loading Skills...");
            watch.Reset();
            watch.Start();
            table           = Core.Database.Query("SELECT * FROM dbskill");
            table.TableName = "SkillDB Table";
            if (table == null || table.Rows.Count == 0)
            {
                if (Core.Database.LastError != null)
                {
                    ServerConsole.ErrorLine("failed to load Skill Database!");
                    ServerConsole.WriteLine(Core.Database.LastError.ToString());
                }
            }
            else
            {
                SkillDatabaseData skill;
                for (int i = 0; i < table.Rows.Count; i++)
                {
                    skill = SkillDatabaseData.Load(table.Rows[i]);
                    if (skill == null)
                    {
                        ServerConsole.WarningLine("Failed to load skill {0}: #{1} {2}", i, table.Rows[i].Field <int>("skillID"), table.Rows[i].Field <string>("name"));
                        continue;
                    }
                    Database.Add(skill.Index, skill);

                    //ServerConsole.DebugLine("\tLoad: #{0} {1} ({2} level)", skill.ID.ToString().PadLeft(5), skill.Name, skill.Level.Count);
                }
            }
            watch.Stop();
            ServerConsole.WriteLine(EConsoleColor.Status, " done (" + Database.Skill.Count + " Skills in " + watch.ElapsedMilliseconds + "ms)");
            #endregion


            // Loading other shit
            // o.o

            //------------- loading end -------------

            // Trigger event for scripts
            Events.InvokeWorldLoadFinish();

            Loading = false;
            Loaded  = true;

            ProcessSafetyQueues();

            // TODO: Initialize save timer

            ServerConsole.InfoLine("Finished World loading! Needed {0:F2} sec", watchAll.Elapsed.TotalSeconds);

            watch.Stop();
            watch = null;
            watchAll.Stop();
            watchAll = null;
        }
    /// <summary>
    /// アクションの実行
    /// </summary>
    /// <param name="bmt"></param>
    public void Action(BattleMapTile bmt)
    {
        BattleMapActionStatus actionStatus = holder.BattleMapStatus.BattleMapActionStatus;

        BattleMapMonster monster = holder.BattleMapMonsters.GetMonster(bmt);

        // スキル選択前
        if (actionStatus == null ||
            actionStatus.BattleMapActionStatusType == BattleMapActionStatusType.BEFORE_TARGET_SELECT)
        {
            // モンスターがいないなら終了
            if (monster == null)
            {
                return;
            }

            // ターゲット選択
            SelectTarget(monster);
        }

        // スキル選択中にモンスターの変更
        else if (actionStatus.BattleMapActionStatusType == BattleMapActionStatusType.BEFORE_SKILL_SELECT ||
                 actionStatus.BattleMapActionStatusType == BattleMapActionStatusType.CONFIRM_SKILL_SELECT)
        {
            // モンスターがいない
            if (monster == null)
            {
                CloseSelectSkill();
                return;
            }

            // モンスターが異なる場合はターゲットの変更
            if (actionStatus.TargetMonster != monster)
            {
                // 選択中キャラの強調表示を解除
                iconController.UnHighlightMarker(actionStatus.TargetMonster);

                // ターゲットの選択しなおし
                SelectTarget(monster);
            }
        }

        // 敵を選択
        else if (actionStatus.BattleMapActionStatusType == BattleMapActionStatusType.BEFORE_OPPONENT_SELECT)
        {
            MonsterSkill skill = actionStatus.SelectedSkill;

            // スキルのタイプが敵のみ
            if (skill.MonsterSkillTargetType == MonsterSkillTargetType.ONLY_ENEMY)
            {
                // モンスターがいない、同じチームならなにもしない
                if (monster == null ||
                    actionStatus.TargetMonster.Team == monster.Team)
                {
                    return;
                }

                // 相手を選択
                SelectOpponent(monster);
            }
        }

        // 選択確認
        else if (actionStatus.BattleMapActionStatusType == BattleMapActionStatusType.CONFIRM_OPPONENT_SELECT)
        {
            MonsterSkill skill = actionStatus.SelectedSkill;

            // スキルのタイプが敵のみ
            if (skill.MonsterSkillTargetType == MonsterSkillTargetType.ONLY_ENEMY)
            {
                // モンスターがいない、同じチームならキャンセル
                if (monster == null ||
                    actionStatus.TargetMonster.Team == monster.Team)
                {
                    // キャンセル
                    CancelOpponentSelect();
                    return;
                }

                // さっきの敵と違う
                else if (monster != actionStatus.OpponentMonster)
                {
                    // キャンセル
                    CancelOpponentSelect();

                    // 選択
                    SelectOpponent(monster);
                }

                // さっきの敵と同じなら戦闘の実行
                else if (monster == actionStatus.OpponentMonster)
                {
                    // 戦闘
                    Battle();
                }
            }
        }
    }
 /// <summary>
 /// 相手のスキルを設定
 /// </summary>
 /// <param name="skill"></param>
 public void SetSkillReserve(MonsterSkill skill)
 {
     panelOperatorReserve.SetSkill(skill);
 }
 private void copyAll(object sender, EventArgs e)
 {
     copiedMonsterSkill = dataGridView.CurrentRow.DataBoundItem as MonsterSkill;
 }
예제 #23
0
        public AdventureStatus ProcessPlayer(long playerid)
        {
            IBattleEntity attacker;
            IBattleEntity target;

            lock (actors) {
                if (actors.Count < 2)
                {
                    return(AdventureStatus.Exploration);
                }

                foreach (IBattleEntity entity in actors)
                {
                    entity.Refresh();
                }


                attacker = actors[actor];
                actor    = (actor + 1) % actors.Count;
                target   = actors[actor];
            }

            RPGMessageBuilder message = messages?.Create();

            foreach (IBattleEffect effect in attacker.Effects.Where(t => t is IBattleEffect && ((IBattleEffect)t).Type == BattleEffectType.Persistent).Cast <IBattleEffect>())
            {
                EffectResult result = effect.ProcessEffect(attacker, target);
                if (result.Type == EffectResultType.CancelAttack)
                {
                    return(AdventureStatus.MonsterBattle);
                }

                AdventureStatus status = ProcessEffectResult(result, attacker, target, message);
                if (status != AdventureStatus.MonsterBattle)
                {
                    message?.Send();
                    attacker.CleanUp();
                    target.CleanUp();
                    return(status);
                }
            }

            MonsterSkill skill = (attacker as MonsterBattleEntity)?.DetermineSkill();

            if (skill != null)
            {
                skill.Process(attacker, target);
                AdventureStatus status = CheckStatus(attacker, target, message);
                message?.Send();
                return(status);
            }

            float           hitprobability = MathCore.Sigmoid(attacker.Dexterity - target.Dexterity, 1.1f, 0.7f);
            float           dice           = RNG.XORShift64.NextFloat();
            AdventureStatus returnstatus   = AdventureStatus.MonsterBattle;

            if (dice < hitprobability)
            {
                bool hit = true;
                foreach (IBattleEffect effect in target.Effects.Where(t => (t as IBattleEffect)?.Type == BattleEffectType.Defense).Cast <IBattleEffect>())
                {
                    if (effect.ProcessEffect(attacker, target).Type == EffectResultType.CancelAttack)
                    {
                        hit = false;
                        break;
                    }
                }

                if (hit)
                {
                    bool damagecritical = attacker.WeaponOptimum > 0 && RNG.XORShift64.NextFloat() < (float)attacker.Luck / attacker.WeaponOptimum;
                    bool armorcritical  = target.ArmorOptimum > 0 && RNG.XORShift64.NextFloat() < (float)target.Luck / target.ArmorOptimum;

                    int power = damagecritical ? attacker.Power * 2 : attacker.Power;
                    int armor = armorcritical ? target.Defense * 2 : target.Defense;

                    int damage = (int)Math.Max(0, (power - armor) * (0.5f + 0.5f * dice / hitprobability));
                    if (damage <= 0)
                    {
                        message?.BattleActor(target);
                        if (armorcritical)
                        {
                            message?.Bold();
                        }

                        message?.Text(" deflects ").Reset().BattleActor(attacker).Text("'s attack.");
                        target.Hit(0);
                    }
                    else
                    {
                        message?.BattleActor(attacker);
                        if (damagecritical)
                        {
                            message?.Bold();
                        }

                        message?.Text(armorcritical ? " clashes with " : " hits ");
                        message?.Reset().BattleActor(target).Text(" for ").Damage(damage).Text(".");

                        IBattleEffect effect = attacker.Effects.FirstOrDefault(e => e is ShittyWeaponEffect) as IBattleEffect;
                        ProcessEffectResult(effect?.ProcessEffect(attacker, target), attacker, target, message);

                        target.Hit(damage);
                        returnstatus = CheckStatus(attacker, target, message);
                        if (returnstatus == AdventureStatus.MonsterBattle)
                        {
                            if (target is PlayerBattleEntity)
                            {
                                message?.Text(" ").BattleActor(target).Text(" has ").Health(target.HP).Text(" left.");
                            }
                        }
                        else
                        {
                            attacker.CleanUp();
                            target.CleanUp();
                        }
                    }
                }
            }
            else
            {
                message?.BattleActor(attacker).Text(" attacks ").BattleActor(target).Text(" but ").Color(AdventureColors.Miss).Text("misses").Reset().Text(".");
            }

            message?.Send();
            return(returnstatus);
        }
예제 #24
0
 public void setUsingSkill(MonsterSkill skill)
 {
     this.usingSkill = skill;
 }
 public GameObject GetSkillButtonGameObject(MonsterSkill skill)
 {
     return(SkillButtonGameObjectList.First <GameObject>(
                go => go.GetComponentInChildren <Text>().text == skill.Name));
 }
 /// <summary>
 /// スキルを設定
 /// </summary>
 /// <param name="skill"></param>
 public void SetSkill(MonsterSkill skill)
 {
     panelOperator.SetSkill(skill);
 }
예제 #27
0
 public _0024UseSkill_0024191(MonsterSkill self_)
 {
     _0024self__0024196 = self_;
 }
 public void ConfirmSkill(BattleMapMonster monster, MonsterSkill skill)
 {
     skillSelectOperator.SetSkillHighlight(monster, skill);
 }