Beispiel #1
0
 public HeroInBattle(HeroInBattle _hero)
 {
     hero = new Hero(_hero.hero);
     ResetStatus();
     status.team = _hero.status.team;
 }
Beispiel #2
0
    public TeamEnum Battle(Team teamA, Team teamB)
    {
        //PrintCheckTime("start");
        teamA.ResetStatus();
        teamB.ResetStatus();
        List <HeroInBattle> sortSpd = new List <HeroInBattle>();

        for (int i = 0; i < 6; i++)
        {
            sortSpd.Add(teamA.heros[i]);
        }

        for (int i = 0; i < 6; i++)
        {
            sortSpd.Add(teamB.heros[i]);
        }

        for (int i = 0; i < 11; i++)
        {
//			if(sortSpd[i].hero.id==3)
//			{
//				Print("tracking");
//			}
            for (int j = i + 1; j < 12; j++)
            {
                if (sortSpd[i].hero.spd < sortSpd[j].hero.spd)
                {
                    HeroInBattle hero = sortSpd[i];
                    sortSpd[i] = sortSpd[j];
                    sortSpd[j] = hero;
                }
            }
        }


        for (int i = 0; i < 15; i++)
        {
            for (int j = 0; j < 12; j++)
            {
                HeroInBattle heroAtt = sortSpd[j];
                if (heroAtt.status.isDead == false)
                {
                    HeroInBattle heroDef = null;
                    Team         teamDef = null;
                    if (heroAtt.status.team == teamA.team)
                    {
                        teamDef = teamB;
                    }
                    else
                    {
                        teamDef = teamA;
                    }
                    heroDef = teamDef.GetFirstHeroIsLive();
//					if(heroAtt==null || heroDef==null)
//					{
//						//Print("turn "+i.ToString() +"   "+j.ToString()+"   "+heroAtt.status.team,1);
//						teamA.Print();
//						teamB.Print();
//					}
                    if (heroAtt.status.pow >= 100)
                    {
                        heroDef.status.hp  -= Mathf.Max((heroAtt.hero.atk * 2 / (heroDef.hero.def / 100)), 0);
                        heroDef.status.pow += 10;
                        heroAtt.status.pow  = 0;
                        if (heroDef.status.hp <= 0)
                        {
                            heroDef.status.isDead = true;
                            if (teamDef.IsDeadAll())
                            {
                                Print(heroAtt.status.team.ToString() + "is win in turn " + i.ToString(), 3);
                                return(heroAtt.status.team);
                            }
                        }
                    }
                    else
                    {
                        heroDef.status.hp  -= Mathf.Max((heroAtt.hero.atk / (heroDef.hero.def / 100)), 0);
                        heroDef.status.pow += 10;
                        heroAtt.status.pow += 50;
                        if (heroDef.status.hp <= 0)
                        {
                            heroDef.status.isDead = true;
                            if (teamDef.IsDeadAll())
                            {
                                //	Print (heroAtt.status.team.ToString() + "is win in turn "+i.ToString(),3);

                                return(heroAtt.status.team);
                            }
                        }
                    }
                }
            }
            //gethero
            //att
            //get
            //
            //..
            //..
            //..
            //reset
        }
        //	Print("Draw battle, team B win",3);

        return(teamB.team);
    }