コード例 #1
0
ファイル: Bless.cs プロジェクト: travislynn/AdventureGame
        public object Clone()
        {
            Bless bless = new Bless();

            bless.unlocked   = this.unlocked;
            bless.unlockedAt = this.unlockedAt;
            return(bless);
        }
コード例 #2
0
ファイル: Priest.cs プロジェクト: ciarano84/barony
 public void Bless(Unit mover)
 {
     foreach (Unit unit in Initiative.order)
     {
         if (RangeFinder.LineOfSight(owner, unit))
         {
             if (unit.unitInfo.faction == Factions.players && (unit.gameObject != gameObject))
             {
                 //check there are no effects of the same name.
                 if (unit.gameObject.GetComponent <Bless>() == null)
                 {
                     Bless bless = unit.gameObject.AddComponent <Bless>();
                     bless.AddEffect(gameObject);
                 }
                 else if (!unit.gameObject.GetComponent <Bless>().enabled)
                 {
                     unit.gameObject.GetComponent <Bless>().enabled = true;
                     unit.gameObject.GetComponent <Bless>().AddEffect(gameObject);
                 }
             }
         }
     }
 }
コード例 #3
0
ファイル: Mage.cs プロジェクト: will-scc/ATRoYStatCalc
        public override void CalculateAttributeBonuses()
        {
            int levelBonus = 0;

            if (CurrentLevel > 130)
            {
                levelBonus = 2;
            }
            else if (CurrentLevel > 140)
            {
                levelBonus = 3;
            }

            int ptmBonus = GetPtmBonus();

            //Unblessed attributes (WIAS) used to calculate bless attribute mod
            foreach (var attribute in Attributes)
            {
                attribute.WarriorBonus = TimeWarriorBonus / 2;
                attribute.LevelBonus   = levelBonus;
                attribute.BlessBonus   = 0;
            }

            Bless.LevelBonus = levelBonus;
            Bless.PtmBonus   = 0;
            Bless.SetAttributeBonus(Attributes);

            if (Blessed)
            {
                //Calculate attribute bonus from unblessed bless mod
                foreach (var attribute in Attributes)
                {
                    attribute.BlessBonus = (int)((double)Bless.Mod / 4);
                }

                //Calculate bless mod from bless
                Bless.SetAttributeBonus(Attributes);
            }

            base.CalculateAttributeBonuses();

            //Arbitrary bonuses added for balance
            //Makes PTMs less linear
            foreach (var skill in Skills)
            {
                skill.LevelBonus = levelBonus;

                if (skill.Type == Skill.Types.MagicShield && CurrentLevel > 140)
                {
                    skill.LevelBonus -= 1;
                }

                if (skill.Type != Skill.Types.Hitpoints &&
                    skill.Type != Skill.Types.Endurance &&
                    skill.Type != Skill.Types.Mana &&
                    skill.Type != Skill.Types.Profession)
                {
                    skill.PtmBonus = ptmBonus;
                }
            }
        }
コード例 #4
0
        private void CalculateAttributeBonuses()
        {
            int levelBonus  = CurrentLevel > 160 ? 1 : 0;
            int ptmBonus    = GetPtmBonus();
            int tacBonus    = GetTacticsSkillBonus();     //will be 0 if not shown
            int tacImmBonus = GetTacticsSkillBonus(true); //will be 0 if not shown

            //Unblessed attributes (WIAS) used to calculate bless attribute mod
            foreach (var attribute in Attributes)
            {
                attribute.WarriorBonus = TimeWarriorBonus / 2;
                attribute.LevelBonus   = levelBonus;
                attribute.BlessBonus   = 0;
            }

            Tactics.LevelBonus = levelBonus;

            //Calculate bless mod from unblessed WIAS
            Bless.LevelBonus = levelBonus;
            Bless.PtmBonus   = 0;
            Bless.SetAttributeBonus(Attributes, tacBonus);

            if (Blessed)
            {
                //Calculate attribute bonus from unblessed bless mod
                foreach (var attribute in Attributes)
                {
                    attribute.BlessBonus = (int)((Bless.Mod + (Tactics.Mod * 0.125)) / 4);
                }

                //Calculate bless mod from bless
                Bless.SetAttributeBonus(Attributes, tacBonus);
            }

            foreach (var skill in Skills)
            {
                skill.LevelBonus = levelBonus;

                if (skill.Type == Skill.Types.Attack ||
                    skill.Type == Skill.Types.Parry ||
                    skill.Type == Skill.Types.Warcry ||
                    skill.Type == Skill.Types.Freeze ||
                    skill.Type == Skill.Types.Lightning ||
                    skill.Type == Skill.Types.Fire)
                {
                    skill.SetAttributeBonus(Attributes, tacBonus);
                }
                else if (skill.Type == Skill.Types.Immunity)
                {
                    skill.SetAttributeBonus(Attributes, tacImmBonus);
                }
                else
                {
                    if (skill.Type == Skill.Types.Bless)
                    {
                        skill.SetAttributeBonus(Attributes, (int)(Tactics.Mod * 0.125));
                    }
                    else
                    {
                        skill.SetAttributeBonus(Attributes);
                    }
                }

                if (skill.Type != Skill.Types.Hitpoints &&
                    skill.Type != Skill.Types.Endurance &&
                    skill.Type != Skill.Types.Mana &&
                    skill.Type != Skill.Types.Profession)
                {
                    skill.PtmBonus = ptmBonus;
                }
            }
        }
コード例 #5
0
 // Update is called once per frame
 void Update()
 {
     bless_ff = Bless.Get_Bless_f();
     if (bless_ff == true)
     {
         //敵と自分が当たった(ダメージを受けた時)
         hit_check1 = true;
         time_f     = true;
         damage_cnt++;
         //sound02.PlayOneShot(sound02.clip);
         audioSources.PlayOneShot(sound02);
         combo_score_f = true;
         TextPlus.SetActive(true);
         ComboTextPlus.SetActive(true);
         script2.Combo_Score();
         if (damage_cnt == 1)
         {
             HeartObj1.color = new Color(0, 0, 0, alpha.a);
         }
         if (damage_cnt == 2)
         {
             HeartObj2.color = new Color(0, 0, 0, alpha.a);
         }
         if (damage_cnt >= 3)
         {
             you_score     = Score.getScore();
             you_highScore = Score.GetHighScore();
             // スコアを保存する
             PlayerPrefs.SetInt("Score", you_score);
             Scene_name = PlayerPrefs.GetString("Scene_name");
             if (Scene_name == "Stage01")
             {
                 PlayerPrefs.SetInt("highScore1", you_highScore);
             }
             if (Scene_name == "Stage02")
             {
                 PlayerPrefs.SetInt("highScore2", you_highScore);
             }
             if (Scene_name == "Stage03")
             {
                 PlayerPrefs.SetInt("highScore3", you_highScore);
             }
             PlayerPrefs.Save();
             HeartObj3.color = new Color(0, 0, 0, alpha.a);
             SceneManager.LoadScene("GameOver");
             //SceneManager.LoadScene("Reward");
         }
     }
     if (hit_check1 == true)
     {//敵に当たった時、点滅処理
         if (Time.time > nextTime && time_cnt < 40 && time_f == true)
         {
             ren.enabled = !ren.enabled;
             nextTime   += interval;
             time_cnt++;
             if (time_cnt == 40)
             {
                 time_cnt       = 0;
                 time_f         = false;
                 hit_check1     = false;
                 vibration_time = 0;
             }
         }
     }
     if (hit_check1 == false)
     {
         combo_score_f = false;
     }
 }
コード例 #6
0
 // Update is called once per frame
 void Update()
 {
     bless_ff  = Bless.Get_Bless_f();
     Heart_Add = Skill_Button.GetHeart_Add();
     if (Heart_Add == true)
     {
         GetHeartDate();
         Heart_Add = false;
     }
     Heart_del = false;
     //life_num = Skill_Button.GetHeart();
     Debug.Log("life_num = " + life_num);
     //life_cnt = Skill_Button.HP_restart();
     if (hit_check1 == true)
     {//敵に当たった時、点滅処理
         if (Time.time > nextTime && time_cnt < 40 && time_f == true)
         {
             ren.enabled = !ren.enabled;
             nextTime   += interval;
             time_cnt++;
             if (time_cnt == 40)
             {
                 time_cnt       = 0;
                 time_f         = false;
                 hit_check1     = false;
                 vibration_time = 0;
             }
         }
     }
     if (skill != 4)
     {
         if (life_num == 1)
         {
             HeartObj1.GetComponent <SpriteRenderer>().color = new Color(0, 0, 0, alpha.a);
             HeartObj2.GetComponent <SpriteRenderer>().color = new Color(0, 0, 0, alpha.a);
             HeartObj3.GetComponent <SpriteRenderer>().color = new Color(255, 255, 255, 255);
         }
         if (life_num == 2)
         {
             HeartObj1.GetComponent <SpriteRenderer>().color = new Color(0, 0, 0, alpha.a);
             HeartObj2.GetComponent <SpriteRenderer>().color = new Color(255, 255, 255, 255);
             HeartObj3.GetComponent <SpriteRenderer>().color = new Color(255, 255, 255, 255);
         }
         if (life_num == 3)  //スタート時
         {
             HeartObj1.GetComponent <SpriteRenderer>().color = new Color(255, 255, 255, 255);
             HeartObj2.GetComponent <SpriteRenderer>().color = new Color(255, 255, 255, 255);
             HeartObj3.GetComponent <SpriteRenderer>().color = new Color(255, 255, 255, 255);
         }
     }
     if (skill == 4)
     {
         if (life_num == 1)
         {
             HeartObj1.GetComponent <SpriteRenderer>().color = new Color(0, 0, 0, 255);
             HeartObj2.GetComponent <SpriteRenderer>().color = new Color(0, 0, 0, 255);
             HeartObj3.GetComponent <SpriteRenderer>().color = new Color(255, 255, 255, 255);
             HeartObj4.GetComponent <SpriteRenderer>().color = new Color(0, 0, 0, 255);
             HeartObj5.GetComponent <SpriteRenderer>().color = new Color(0, 0, 0, 255);
             HeartObj6.GetComponent <SpriteRenderer>().color = new Color(0, 0, 0, 255);
         }
         if (life_num == 2)
         {
             HeartObj1.GetComponent <SpriteRenderer>().color = new Color(0, 0, 0, 255);
             HeartObj2.GetComponent <SpriteRenderer>().color = new Color(255, 255, 255, 255);
             HeartObj3.GetComponent <SpriteRenderer>().color = new Color(255, 255, 255, 255);
             HeartObj4.GetComponent <SpriteRenderer>().color = new Color(0, 0, 0, 255);
             HeartObj5.GetComponent <SpriteRenderer>().color = new Color(0, 0, 0, 255);
             HeartObj6.GetComponent <SpriteRenderer>().color = new Color(0, 0, 0, 255);
         }
         if (life_num == 3)  //スタート時
         {
             HeartObj1.GetComponent <SpriteRenderer>().color = new Color(255, 255, 255, 255);
             HeartObj2.GetComponent <SpriteRenderer>().color = new Color(255, 255, 255, 255);
             HeartObj3.GetComponent <SpriteRenderer>().color = new Color(255, 255, 255, 255);
             HeartObj4.GetComponent <SpriteRenderer>().color = new Color(0, 0, 0, 255);
             HeartObj5.GetComponent <SpriteRenderer>().color = new Color(0, 0, 0, 255);
             HeartObj6.GetComponent <SpriteRenderer>().color = new Color(0, 0, 0, 255);
         }
         if (life_num == 4)
         {
             HeartObj1.GetComponent <SpriteRenderer>().color = new Color(255, 255, 255, 255);
             HeartObj2.GetComponent <SpriteRenderer>().color = new Color(255, 255, 255, 255);
             HeartObj3.GetComponent <SpriteRenderer>().color = new Color(255, 255, 255, 255);
             HeartObj4.GetComponent <SpriteRenderer>().color = new Color(255, 255, 255, 255);
             HeartObj5.GetComponent <SpriteRenderer>().color = new Color(0, 0, 0, 255);
             HeartObj6.GetComponent <SpriteRenderer>().color = new Color(0, 0, 0, 255);
         }
         if (life_num == 5)
         {
             HeartObj1.GetComponent <SpriteRenderer>().color = new Color(255, 255, 255, 255);
             HeartObj2.GetComponent <SpriteRenderer>().color = new Color(255, 255, 255, 255);
             HeartObj3.GetComponent <SpriteRenderer>().color = new Color(255, 255, 255, 255);
             HeartObj4.GetComponent <SpriteRenderer>().color = new Color(255, 255, 255, 255);
             HeartObj5.GetComponent <SpriteRenderer>().color = new Color(255, 255, 255, 255);
             HeartObj6.GetComponent <SpriteRenderer>().color = new Color(0, 0, 0, 255);
         }
         if (life_num == 6)
         {
             HeartObj1.GetComponent <SpriteRenderer>().color = new Color(255, 255, 255, 255);
             HeartObj2.GetComponent <SpriteRenderer>().color = new Color(255, 255, 255, 255);
             HeartObj3.GetComponent <SpriteRenderer>().color = new Color(255, 255, 255, 255);
             HeartObj4.GetComponent <SpriteRenderer>().color = new Color(255, 255, 255, 255);
             HeartObj5.GetComponent <SpriteRenderer>().color = new Color(255, 255, 255, 255);
             HeartObj6.GetComponent <SpriteRenderer>().color = new Color(255, 255, 255, 255);
         }
     }
     if (hit_check1 == false)
     {
         combo_score_f = false;
     }
     if (bless_ff == true)
     {
         GetHeartDate();
         if (life_num > 0)
         {
             life_num -= 1;
         }
         SaveHeartDate();
         Heart_del  = true;
         hit_check1 = true;
         time_f     = true;
         damage_cnt++;
         //sound02.PlayOneShot(sound02.clip);
         audioSources.PlayOneShot(sound02);
         combo_score_f = true;
         TextPlus.SetActive(true);
         ComboTextPlus.SetActive(true);
         script2.Combo_Score();
         if (life_num <= 0)
         {
             you_score     = Score_Endless.getScore();
             you_highScore = Score_Endless.gethighScore();
             // スコアを保存する
             PlayerPrefs.SetInt("Score", you_score);
             PlayerPrefs.SetInt("highScore", you_highScore);
             PlayerPrefs.Save();
             SceneManager.LoadScene("GameOver_Endless");
             //SceneManager.LoadScene("Reward");
         }
     }
 }