Esempio n. 1
0
    public override void ApplyModToShip(ShipBase ship)
    {
        ShieldBase shield = ship.Shield;

        if (shield == null)
        {
            return;
        }

        foreach (KeyValuePair <string, float> attribute in NumericAttributes)
        {
            switch (attribute.Key)
            {
            case "Capacity":
                shield.TotalCapacity += attribute.Value;
                break;

            case "Capacity%":
                shield.TotalCapacity += shield.TotalCapacity * attribute.Value;
                break;

            case "RechargeRate":
                shield.RechargeRate += attribute.Value;
                break;

            case "RechargeRate%":
                shield.RechargeRate += shield.RechargeRate * attribute.Value;
                break;
            }
        }

        Debug.Log("Shield capacity " + shield.TotalCapacity);
    }
Esempio n. 2
0
 public override void ApplyModToShip(ShipBase ship)
 {
     MyShip         = ship;
     MyShield       = ship.Shield;
     _currentCharge = 0;
     _capacity      = NumericAttributes["Capacity"];
 }
    public static ShieldBase GetItem(long objNo, bool isRandomValue)
    {
        TableShieldData data = Array.Find(Table, i => i.ObjNo == objNo);
        ShieldBase      item = new ShieldBase();

        item.Initialize();
        if (GameStateInformation.IsEnglish == false)
        {
            item.DisplayName = data.DisplayName;
            item.Description = data.Description;
        }
        else
        {
            item.DisplayName = data.DisplayNameEn;
            item.Description = data.DescriptionEn;
        }
        item.ApType            = data.ApType;
        item.ObjNo             = data.ObjNo;
        item.ShieldBaseDefense = data.Defense;
        item.ThrowDexterity    = data.ThrowDexterity;

        if (isRandomValue == false)
        {
            return(item);
        }
        QualifyInformation q = TableQualify.GetRandomName(data.Level);

        item.DisplayNameBefore      = q.Name;
        item.DisplayNameBeforeObjNo = q.ObjNo;
        item.StrengthValue          = CommonFunction.ConvergenceRandom(data.StrengthAddStart, data.StrengthAddContinue, data.StrengthnAddReduce);
        int optioncount = CommonFunction.ConvergenceRandom(data.OptionAddStart, data.OptionAddContinue, data.OptionAddReduce);
        int index       = 0;

        for (int i = 0; i < optioncount; i++)
        {
            //30回回して終わらなかったら強制終了
            if (index > 30)
            {
                break;
            }
            index++;
            uint       rnd    = CommonFunction.GetRandomUInt32();
            BaseOption newOpt = TableOptionCommon.GetValue(OptionBaseType.Shield, rnd, data.OptionPowStart, data.OptionPowContinue, data.OptionPowReduce);

            //同じオプションがすでに含まれていたらもう一度算出
            if (CommonFunction.IsNull(newOpt) == true)
            {
                i--;
                continue;
            }
            BaseOption containOpt = item.Options.Find(o => o.ObjNo == newOpt.ObjNo);
            if (CommonFunction.IsNull(containOpt) == false)
            {
                i--;
                continue;
            }
            item.Options.Add(newOpt);
        }
        return(item);
    }
Esempio n. 4
0
    public virtual void OnCollisionEnter(Collision collision)
    {
        //Debug.Log("Hit something " + collision.collider.name);

        ShipReference hitShip = null;

        //Debug.Log(collision.collider.name);


        hitShip = collision.collider.GetComponent <ShipReference>();



        if (hitShip != null)
        {
            if (hitShip.ParentShip == Attacker)
            {
                return;
            }
            else
            {
                //Debug.Log("Hit shield");
                ShieldBase shield = hitShip.Shield.GetComponent <ShieldBase>();

                if (shield.ParentShip == Attacker)
                {
                    return;
                }
                if (Damage.DamageType != DamageType.Shock)
                {
                    Damage.ShieldAmount *= DamageMultiplier;
                    Damage.HullAmount   *= DamageMultiplier;
                }
                if (Attacker == GameManager.Inst.PlayerControl.PlayerShip)
                {
                    GameManager.Inst.SoundManager.PlayUISoundRateLimited("HitMarkerSoft", 0.1f);
                }

                Damage.HitLocation = collision.contacts[0].point;
                Damage             = shield.ProcessDamage(Damage);
                if (Damage.HullAmount <= 1f)
                {
                    GameObject.Destroy(this.gameObject);
                    return;
                }

                hitShip.ParentShip.ProcessHullDamage(Damage, Attacker);


                GameObject.Destroy(this.gameObject);
            }
        }
        else
        {
            GameObject.Destroy(this.gameObject);
        }
    }
Esempio n. 5
0
        private ShieldBase FindShield()
        {
            ShieldBase shield = null;

            foreach (Item item in player.inventory.Where(t => t.modItem != null && t.modItem is ShieldBase))
            {
                shield = item.modItem as ShieldBase;
            }

            return(shield);
        }
Esempio n. 6
0
        public void AddConnector(String name, Enums.ConnectorType type, String[] directions)
        {
            foreach (String dir in directions)
            {
                if (!ShieldBase.IsConnectable(dir, type))
                {
                    throw new Exception("El tipo de conector no es compatible en esa direccion del micro");
                }
            }

            Connectors.Add(new Connector(name, type, directions));
        }
Esempio n. 7
0
    private void UpdateShieldAmount()
    {
        ShieldBase shieldBase = GameManager.Inst.PlayerControl.PlayerShip.Shield;

        if (shieldBase != null && shieldBase.Type == ShieldType.Fighter)
        {
            FighterShield shield = (FighterShield)shieldBase;
            ShieldAmountIndicator.SetFillPercentage(shield.GetShieldPercentage());
            ShieldAmount.text = Mathf.FloorToInt(shield.Amount).ToString();
        }
        else if (shieldBase != null && shieldBase.Type == ShieldType.BigShip)
        {
            BigShipShield shield = (BigShipShield)shieldBase;
            ShieldAmountIndicator.SetFillPercentage(shield.GetShieldPercentage());
            ShieldAmount.text = Mathf.FloorToInt(shield.Amount).ToString();
        }
    }
Esempio n. 8
0
    public virtual AttackState Attack(ManageDungeon dun, BaseCharacter target, BaseCharacter attacker, int power, AttackInformation atinf)
    {
        int damage = 0;

        atinf.AddTarget(target);

        //声を鳴らす
        atinf.AddVoice(attacker.VoiceAttack());

        //攻撃の命中判定
        if (CommonFunction.IsRandom(WeaponDexterity) == true)
        {
            //行動タイプを設定
            atinf.SetBehType(BehaviorType.Attack);

            //命中したら
            atinf.AddHit(target, true);

            //声を鳴らす
            atinf.AddVoice(target.VoiceDefence());

            //サウンドを鳴らす
            atinf.AddSound(GetAttackHitSound());

            BaseOption[] atoptions = attacker.Options;
            BaseOption[] tgoptions = target.Options;

            //与ダメージを計算
            damage = CalcDamage(dun, attacker, target, power, atoptions, tgoptions, 1);

            //スコア関連値の更新
            if (target.Type == ObjectType.Enemy)
            {
                TotalDamage += damage;
                if (ScoreInformation.Info.MostUseWeaponDamage < TotalDamage)
                {
                    ScoreInformation.Info.MostUseWeaponDamage = TotalDamage;
                    ScoreInformation.Info.MostUseWeaponName   = DisplayNameNormal;
                }

                ScoreInformation.Info.AddScore(damage);
            }

            //atinf.AddDamage(target.Name, damage);

            ////ヒットメッセージ
            //atinf.AddMessage(
            //    target.GetMessageAttackHit(this.DisplayNameInMessage, damage));

            ////ダメージ判定
            //AttackState atState = target.AddDamage(damage);
            //ダメージ追加
            AttackState atState = CommonFunction.AddDamage(atinf, attacker, target, damage);

            //ガラスアイテム判定
            WeaponBase atw = attacker.EquipWeapon;
            foreach (BaseOption op in atw.Options)
            {
                if (op.IsBreak() == true)
                {
                    atinf.AddSound(SoundInformation.SoundType.Break);

                    atinf.AddMessage(
                        string.Format(CommonConst.Message.BreakItem, atw.DisplayNameInMessage));

                    atw.ForceRemoveEquip(attacker);
                    PlayerCharacter.RemoveItem(atw);
                }
            }
            ShieldBase tgs = target.EquipShield;
            foreach (BaseOption op in tgs.Options)
            {
                if (op.IsBreak() == true)
                {
                    atinf.AddSound(SoundInformation.SoundType.Break);

                    atinf.AddMessage(
                        string.Format(CommonConst.Message.BreakItem, tgs.DisplayNameInMessage));

                    tgs.ForceRemoveEquip(target);
                    PlayerCharacter.RemoveItem(tgs);
                }
            }


            //対象が死亡したら
            if (atState == AttackState.Death)
            {
                atinf.AddKillList(target);

                atinf.AddMessage(
                    target.GetMessageDeath(target.HaveExperience));
            }
            else
            {
                //atinf.IsDeath.Add(target.Name, false);

                addabnormal.Clear();
                prevents.Clear();
                foreach (StateAbnormal val in CommonFunction.StateAbnormals)
                {
                    prevents.Add(val, 0);
                    addabnormal.Add(val, AddAbnormalProb[val]);
                }

                int opab = 0;
                //オプションの付加値設定
                foreach (BaseOption o in atoptions)
                {
                    int ab = o.SetAbnormalAttack(addabnormal);
                    opab = opab | ab;
                }

                int tarabn = AddAbnormal | opab;

                if (tarabn != 0)
                {
                    //オプションによる状態異常の取得
                    //foreach (StateAbnormal val in CommonFunction.StateAbnormals)
                    //{
                    //    addabnormal.Add(val, 0);
                    //}

                    //オプションの抵抗値設定
                    foreach (BaseOption o in tgoptions)
                    {
                        o.SetAbnormalPrevent(prevents);
                    }

                    int abn = 0;
                    //状態異常の付与
                    foreach (StateAbnormal val in CommonFunction.StateAbnormals)
                    {
                        int abnormal = (int)val & tarabn;

                        //対象の状態異常を処理
                        if (abnormal != 0)
                        {
                            //float prob = prevents[val] > AddAbnormalProb[val] ? prevents[val] : AddAbnormalProb[val];
                            //状態異常付与が成功したとき
                            if (CommonFunction.IsRandom(addabnormal[val]) == true)
                            {
                                //抵抗に成功したとき
                                if (CommonFunction.IsRandom(prevents[val]) == true)
                                {
                                }
                                else
                                {
                                    int addstate = target.AddStateAbnormal(abnormal);
                                    if (addstate != 0)
                                    {
                                        abn += abnormal;
                                        //atinf.AddAbnormal(target, abnormal);

                                        atinf.AddMessage(
                                            CommonFunction.GetAbnormalMessage(val, target));
                                    }
                                }
                            }
                        }
                    }
                    if (abn != 0)
                    {
                        atinf.AddEffect(EffectBadSmoke.CreateObject(target));
                        atinf.AddAbnormal(target, abn);
                    }
                }
            }

            //エフェクトをかける
            this.AttackEffect(target, attacker, damage.ToString(), AttackState.Hit, atinf);

            return(atState);
        }
        else
        {
            //外れた場合
            atinf.AddHit(target, false);

            EffectDamage d = EffectDamage.CreateObject(target);
            d.SetText("Miss", AttackState.Miss);
            atinf.AddEffect(d);

            atinf.AddSound(GetAttackMissSound());

            atinf.AddMessage(
                target.GetMessageAttackMiss());
            return(AttackState.Miss);
        }
    }
Esempio n. 9
0
 public override bool Equals(ShieldBase other)
 {
     return(other is TowerShield towerShield && tier == towerShield.tier);
 }
Esempio n. 10
0
 public override bool Equals(ShieldBase other)
 {
     return(other is WoodenShield);
 }
Esempio n. 11
0
 public override bool Equals(ShieldBase other)
 {
     return(other is Buckler buckler && tier == buckler.tier);
 }
Esempio n. 12
0
 public override bool Equals(ShieldBase other)
 {
     return(other is GreatShield greatShield && tier == greatShield.tier);
 }
Esempio n. 13
0
 public virtual bool CanUseWithShield(Creature wearer, ShieldBase shield, out string whyNot)
 {
     whyNot = null;
     return(true);
 }
Esempio n. 14
0
 public override bool Equals(ShieldBase other)
 {
     return(other is DragonShellShield dragonShell && dragonShell.tier == tier);
 }
Esempio n. 15
0
 public override bool Equals(ShieldBase other)
 {
     return(other is KiteShield kiteShield && tier == kiteShield.tier);
 }