コード例 #1
0
 public void SetShip(ShipInWar ship, float showTime)
 {
     this.showTime = showTime;
     this.choosedItem = GameObjectUtil.InstantiateItemAsChildOf(this.toChoosePrefab[UnityEngine.Random.Range(0, this.toChoosePrefab.Length)], base.gameObject);
     this.ChangeTime();
     if (this.avatar == null)
     {
         this.avatar = base.GetComponent<UpdateBigAvatarInfo>();
     }
     this.avatar.bodySprite = this.choosedItem.transform.GetChild(0).gameObject;
     this.avatar.SetShip(ship);
     base.Invoke("ActiveChoosedItemAt", 0.1f);
 }
 public void SetShipInRecovry(ShipInWar ship, RecoveryParam shipInRecovery)
 {
     this.recoveParam = shipInRecovery;
     this.ship = ship;
     this.bigAvatar.SetShip(ship);
     if (this.recoveParam.id == 1)
     {
         this.animations[0].SetActive(true);
         this.animations[1].SetActive(false);
     }
     else
     {
         this.animations[0].SetActive(false);
         this.animations[1].SetActive(true);
     }
     base.Invoke("ShowShipRecoverHP", this.recoveHpWaitTime);
 }
コード例 #3
0
 public void SetShipStatusToScene3Close()
 {
     if ((this.hpBeforeNightWarSelf != null) && (this.hpBeforeNightWarSelf.Length > 0))
     {
         for (int i = 0; i < this.selfShips.Length; i++)
         {
             ShipInWar war = this.selfShips[i];
             war.hp = this.hpBeforeNightWarSelf[i];
         }
     }
     if ((this.hpBeforeNightWarEnemy != null) && (this.hpBeforeNightWarEnemy.Length > 0))
     {
         for (int j = 0; j < this.enemyShips.Length; j++)
         {
             ShipInWar war2 = this.enemyShips[j];
             war2.hp = this.hpBeforeNightWarEnemy[j];
         }
     }
 }
コード例 #4
0
 public void DoInitCheck()
 {
     this.selfInitShipStatus = new ShipInWarInitStatus[this.selfShips.Length];
     for (int i = 0; i < this.selfShips.Length; i++)
     {
         ShipInWar war = this.selfShips[i];
         war.InitBrokenType();
         this.selfInitShipStatus[i] = new ShipInWarInitStatus {
             hp = war.hp, hpMax = war.hpMax
         };
     }
     this.enemyInitShipStatus = new ShipInWarInitStatus[this.enemyShips.Length];
     for (int j = 0; j < this.enemyShips.Length; j++)
     {
         ShipInWar war2 = this.enemyShips[j];
         war2.InitBrokenType();
         this.enemyInitShipStatus[j] = new ShipInWarInitStatus {
             hp = war2.hp, hpMax = war2.hpMax
         };
     }
 }
コード例 #5
0
ファイル: helper.cs プロジェクト: lavender1213/ShipGirlBot
        internal static string getDetailWarBattleParam(AttackParam[] ap, UserFleet uf, ShipInWar[] enemy)
        {
            string r = "";
            foreach (var opa in ap)
            {
                if(opa.attackSide == AttackSide.Self)
                {
                    UserShip ata = GameData.instance.GetShipById(uf.ships[opa.fromIndex]);
                    r += "\t " + getshiptype(ata.ship.type) + " " + getFormatedtitle(ata.ship.title) + " Lv." + ata.level + (opa.attackSide == AttackSide.Self ? " => " : " <= ");
                    for (int i = 0; i < opa.targetIndex.Length && i < opa.damage.Length; i++)
                    {
                        ShipInWar siw = enemy[opa.targetIndex[i]];
                        siw.hp -= opa.damage[i];
                        if(siw.hp <0 )
                        {
                            siw.hp = 0;
                        }
                        var damp = opa.damages[i];
                        var eqatk = GameConfigs.instance.GetEquipmentByCid(opa.equipmentCid);
                        var skilldesc = GameConfigs.instance.GetSkillConfig(opa.skillId);

                        r += (opa.damage[i] == 0 ? "MISS" : (" -" + opa.damage[i]))
                            + "\t " + (damp.isCritical == 1 ? " 暴击! " : "       ")
                            + "\t"+ (skilldesc != null ? skilldesc.title : (eqatk != null? eqatk.title:"\t") )
                            + "\t " + getShipAttackTypeString(opa.attackType)
                            +"\t" + siw.title + " Lv." + siw.level + " "
                            + siw.hp + "/" + siw.hpMax;
                    }
                    r += "\r\n";
                }else{
                    ShipInWar ata =enemy[opa.fromIndex];

                    for (int i = 0; i < opa.targetIndex.Length && i < opa.damage.Length; i++)
                    {
                        UserShip siw = GameData.instance.GetShipById(uf.ships[opa.targetIndex[i]]);
                        var damp = opa.damages[i];
                        var eqatk = GameConfigs.instance.GetEquipmentByCid(opa.equipmentCid);

                        r += "\t " + getshiptype(siw.ship.type) + " "+ getFormatedtitle(siw.ship.title) + " Lv." + siw.level + " <= ";
                        r += (opa.damage[i] == 0 ? "MISS" : (" -" + opa.damage[i]))
                            + "\t " + (damp.isCritical == 1 ? " 暴击! " : "       ")
                            + "\t " + (eqatk == null ? "\t " : eqatk.title)
                            + "\t " + getShipAttackTypeString(opa.attackType)
                            + "\t"  + ata.title + " Lv." + ata.level + " "
                            + ata.hp + "/" + ata.hp;
                    }
                    r += "\r\n";
                }

            }
            return r;
        }
コード例 #6
0
 public void SetResult(ShipInWar ship, ShipInWarResult result, ShipResultInfo parentShip)
 {
     this.ship = ship;
     this.shipResult = result;
     this.shipResultInfo = parentShip;
 }
コード例 #7
0
 public void SetShip(ShipInWar ship, [Optional, DefaultParameterValue(false)] bool isFlag)
 {
     this.userShip = ship;
     this.isFlag = isFlag;
     this.UpdateShip();
 }
コード例 #8
0
 private void setStartPosition()
 {
     Vector3 positionOfArmyAt;
     if (this.isSelfArmy)
     {
         positionOfArmyAt = WarManager.instance.selfArmyManager.GetPositionOfArmyAt(this.fromArmyId);
         this.fromArmy = WarManager.instance.WarProgress.selfShips[this.fromArmyId];
     }
     else
     {
         positionOfArmyAt = WarManager.instance.enemyArmyManager.GetPositionOfArmyAt(this.fromArmyId);
         this.fromArmy = WarManager.instance.WarProgress.enemyShips[this.fromArmyId];
     }
     base.gameObject.transform.position = positionOfArmyAt;
 }
コード例 #9
0
ファイル: z.cs プロジェクト: kommnodado/ShipGirlBot
    private bool judge_enemy_case(ShipInWar[] enemyShips, string param2)
    {
        if(param2 != "1" && param2 != "2" && param2 != "3")
            {
                return true;
            }

            int caseship = -1;
            int  casejudge = -1;
            int caseval = -1;

            if(param2 == "1")
            {
                caseship = secase1ship.SelectedIndex;
                casejudge = secase1judge.SelectedIndex;
                caseval = secase1val.Value;
            }else if(param2 == "2")
            {
                caseship = secase2ship.SelectedIndex;
                casejudge = secase2judge.SelectedIndex;
                caseval = secase2val.Value;
            }
            else if (param2 == "3")
            {
                caseship = secase3ship.SelectedIndex;
                casejudge = secase3judge.SelectedIndex;
                caseval = secase3val.Value;
            }

            if(caseship == -1 || casejudge == -1 || caseval == -1)
            {
                log("[自动战斗-索敌控制]条件填写不全....放弃判定");
                return true;
            }

            if(caseship == 0)
            {
                //全部船只,判定条件即可
                switch(casejudge)
                {
                        //大于
                    case 0:
                        if(enemyShips.Length > caseval)
                        {
                            log("[自动战斗-索敌控制] 敌舰 总数 "+ enemyShips.Length + "大于 设定条件 " + caseval+ " 主动归港");
                            return false;
                        }
                        break;
                    //等于
                    case 1:
                        if (enemyShips.Length == caseval)
                        {
                            log("[自动战斗-索敌控制] 敌舰 总数 "+ enemyShips.Length + "等于 设定条件 " + caseval+ " 主动归港");
                            return false;
                        }
                        break;
                    //大于
                    case 2:
                        if (enemyShips.Length < caseval)
                        {
                            log("[自动战斗-索敌控制] 敌舰 总数 "+ enemyShips.Length + "小于 设定条件 " + caseval+ " 主动归港");
                            return false;
                        }
                        break;
                }
                return true;
            }

            //构造船只类型字典
            Dictionary<int, int> shiptypecount = new Dictionary<int, int>();
            for (int i = 0; i < secase1ship.Items.Count;i++ )
            {
                shiptypecount[i] = 0;
            }
            foreach(var s in enemyShips)
            {
                int st = s.type;
                if(shiptypecount.ContainsKey(st) == true)
                {
                    shiptypecount[st] = shiptypecount[st] + 1;
                }
                else
                {
                    shiptypecount[st] = 1;
                }
            }
            switch (casejudge)
            {
                //大于
                case 0:
                    if (shiptypecount.ContainsKey(caseship) == true &&  shiptypecount[caseship] > caseval)
                    {
                        log("[自动战斗-索敌控制] 敌 " + tools.helper.getshiptype((ShipType)caseship)+ "数量 "+ shiptypecount[caseship] + "大于 设定条件 " + caseval+ " 主动归港");
                        return false;
                    }
                    break;
                //等于
                case 1:
                    if (shiptypecount.ContainsKey(caseship) == true && shiptypecount[caseship] == caseval)
                    {
                        log("[自动战斗-索敌控制] 敌 " + tools.helper.getshiptype((ShipType)caseship)+ "数量 "+ shiptypecount[caseship] + "等于 设定条件 " + caseval+ " 主动归港");
                        return false;
                    }
                    break;
                //大于
                case 2:
                    if (shiptypecount.ContainsKey(caseship) == true && shiptypecount[caseship] < caseval)
                    {
                        log("[自动战斗-索敌控制] 敌 " + tools.helper.getshiptype((ShipType)caseship)+ "数量 "+ shiptypecount[caseship] + "小于 设定条件 " + caseval+ " 主动归港");
                        return false;
                    }
                    break;
            }
            return true;
    }