Exemplo n.º 1
0
        public virtual void  checkConditionals(ESMSTeam opponent, int minute)
        {
            bool isTrue;

            Conditional[] cond = Conditionals;
            for (int i = 0; i < cond.Length; i++)
            {
                isTrue = true;
                for (int condition = 0; condition < cond[i].Conditions.Length; condition++)
                {
                    if (!((ESMSCondition)(cond[i].Conditions[condition])).isTrue(this, opponent, minute))
                    {
                        isTrue = false;
                    }
                }
                if (isTrue)
                {
                    try
                    {
                        ((ESMSAction)cond[i].Action).execute(this);
                    }
                    catch (System.Exception err)
                    {
                    }
                }
            }
        }
Exemplo n.º 2
0
        // HZ: ver comentario de InitBlock()
        //internal PenaltyPlayer[][] PenaltyTakers = tmpArray;

        /// <summary>Creates a new instance of PenaltyShootout </summary>
        public PenaltyShootout(ESMSTeam homeTS, ESMSTeam awayTS, System.IO.StreamWriter output)
        {
            InitBlock();
            this.teams[0] = homeTS;
            this.teams[1] = awayTS;
            this.output   = output;
        }
Exemplo n.º 3
0
        public virtual void  calcPlayerContributions(int player, ESMSTeam opponent)
        {
            if (!getPosition(player).Equals("GK") && ((ESMSPlayer)getPlayer(player)).Status == ESMSPlayer.PLAYING)
            {
                double tkMult = Tactic.getMult(opponent.Tactic.Name, getPosition(player), "TK");
                double psMult = Tactic.getMult(opponent.Tactic.Name, getPosition(player), "PS");
                double shMult = Tactic.getMult(opponent.Tactic.Name, getPosition(player), "SH");

                ESMSPlayer temp = ((ESMSPlayer)getPlayer(player));
                temp.tacklingContrib = tkMult * temp.Tackling * temp.fatigue;
                temp.passingContrib  = psMult * temp.Passing * temp.fatigue;
                temp.shootingContrib = shMult * temp.Shooting * temp.fatigue;
            }
            else
            {
                ESMSPlayer temp = ((ESMSPlayer)getPlayer(player));
                temp.tacklingContrib = 0;
                temp.passingContrib  = 0;
                temp.shootingContrib = 0;
            }
        }
Exemplo n.º 4
0
        public virtual void  updateStats(ESMSTeam team)
        {
            this._team_tackling = 0;
            this._team_passing  = 0;
            this._team_shooting = 0;

            this.calcAggression();
            for (int player = 2; player < NumPlayers; player++)
            {
                calcPlayerContributions(player, team);
                calcTeamContributions(player);
            }
            for (int player = 2; player < NumPlayers; player++)
            {
                ESMSPlayer temp = ((ESMSPlayer)getPlayer(player));
                if (temp.Status == ESMSPlayer.PLAYING)
                {
                    temp.fatigue *= 0.996;
                    /*Dovrei tagliare il float a 2 cifre decimali ma non ho idea del perche'*/
                }
            }
        }