public void damage(Combatant attacker)
        {
            //attack the player
            switch(attacker.stance)
            {
                case Stance.NOTHING:
                    {
                        //attacker is not doing anything so return
                        return;
                    }
                case Stance.LEFTJAB:
                    {
                        if(stance != Stance.FLINCHING)
                        {
                            //check to see if the player is blocking and if the player is do quarter damage
                            if(stance == Stance.BLOCKING)
                            {
                                //make the player flinch
                                stance = Stance.FLINCHING;
                                //play the animation
                                model.PlayAnimation("TakePunchLeft",false);
                                punch1.Play();
                                animationSpeed = 5;
                                //check to see if the drunk buffer is greater then 0 and if it is damage the drunk buffer instead.
                                if (drunkBuffer > 0)
                                {
                                    DrunkBuffer -= JABDAMAGE / 4;
                                }
                                else
                                {
                                    HP -= JABDAMAGE / 4;
                                }
                                leftRumbleStrength = (int)JABDAMAGE*10 / 4;

                            }
                            else
                            {
                                //make the player flinch
                                stance = Stance.FLINCHING;
                                //play the animation
                                model.PlayAnimation("TakePunchLeft", false);
                                punch1.Play();
                                animationSpeed = 3;
                                //check to see if the drunk buffer is greater then 0 and if it is damage the drunk buffer instead.
                                if (drunkBuffer > 0)
                                {
                                    DrunkBuffer -= JABDAMAGE;
                                }
                                else
                                {
                                    HP -= JABDAMAGE;
                                }
                                leftRumbleStrength = (int)JABDAMAGE * 10;
                            }
                        }
                        break;
                    }
                case Stance.RIGHTJAB:
                    {
                        if (stance != Stance.FLINCHING)
                        {
                            //check to see if the player is blocking and if the player is do quarter damage
                            if (stance == Stance.BLOCKING)
                            {
                                //make the player flinch
                                stance = Stance.FLINCHING;
                                //play the animation
                                model.PlayAnimation("TakePunchRight", false);
                                punch2.Play();
                                animationSpeed = 5;
                                //check to see if the drunk buffer is greater then 0 and if it is damage the drunk buffer instead.
                                if (drunkBuffer > 0)
                                {
                                    DrunkBuffer -= JABDAMAGE / 4;
                                }
                                else
                                {
                                    HP -= JABDAMAGE / 4;
                                }
                                rightRumbleStrength = (int)JABDAMAGE * 10 / 4;

                            }
                            else
                            {
                                //make the player flinch
                                stance = Stance.FLINCHING;
                                //play the animation
                                model.PlayAnimation("TakePunchRight", false);
                                punch2.Play();
                                animationSpeed = 3;
                                //check to see if the drunk buffer is greater then 0 and if it is damage the drunk buffer instead.
                                if (drunkBuffer > 0)
                                {
                                    DrunkBuffer -= JABDAMAGE;
                                }
                                else
                                {
                                    HP -= JABDAMAGE;
                                }
                                rightRumbleStrength = (int)JABDAMAGE * 10;
                            }
                        }
                        break;
                    }
                case Stance.LEFTPUNCH:
                    {
                        if (stance != Stance.FLINCHING)
                        {
                            //check to see if the player is blocking and if the player is do quarter damage
                            if (stance == Stance.BLOCKING)
                            {
                                //make the player flinch
                                stance = Stance.FLINCHING;
                                //play the animation
                                model.PlayAnimation("TakePunchLeft", false);
                                animationSpeed = 4;
                                punch3.Play();
                                //check to see if the drunk buffer is greater then 0 and if it is damage the drunk buffer instead.
                                if (drunkBuffer > 0)
                                {
                                    DrunkBuffer -= PUNCHDAMAGE / 4;
                                }
                                else
                                {
                                    HP -= PUNCHDAMAGE / 4;
                                }
                                leftRumbleStrength = (int)PUNCHDAMAGE * 10 / 4;
                            }
                            else
                            {
                                //make the player flinch
                                stance = Stance.FLINCHING;
                                //play the animation
                                model.PlayAnimation("TakePunchLeft", false);
                                animationSpeed = 2;
                                punch3.Play();
                                //check to see if the drunk buffer is greater then 0 and if it is damage the drunk buffer instead.
                                if (drunkBuffer > 0)
                                {
                                    DrunkBuffer -= PUNCHDAMAGE;
                                }
                                else
                                {
                                    HP -= PUNCHDAMAGE;
                                }
                                leftRumbleStrength = (int)PUNCHDAMAGE * 10;
                            }
                        }
                        break;
                    }
                case Stance.RIGHTPUNCH:
                    {
                        if (stance != Stance.FLINCHING)
                        {
                            //check to see if the player is blocking and if the player is do quarter damage
                            if (stance == Stance.BLOCKING)
                            {
                                //make the player flinch
                                stance = Stance.FLINCHING;
                                //play the animation
                                model.PlayAnimation("TakePunchRight", false);
                                animationSpeed = 4;
                                punch4.Play();
                                //check to see if the drunk buffer is greater then 0 and if it is damage the drunk buffer instead.
                                if (drunkBuffer > 0)
                                {
                                    DrunkBuffer -= PUNCHDAMAGE / 4;
                                }
                                else
                                {
                                    HP -= PUNCHDAMAGE / 4;
                                }
                                rightRumbleStrength = (int)PUNCHDAMAGE * 10 / 4;

                            }
                            else
                            {
                                //make the player flinch
                                stance = Stance.FLINCHING;
                                //play the animation
                                model.PlayAnimation("TakePunchRight", false);
                                animationSpeed = 2;
                                punch4.Play();
                                //check to see if the drunk buffer is greater then 0 and if it is damage the drunk buffer instead.
                                if (drunkBuffer > 0)
                                {
                                    DrunkBuffer -= PUNCHDAMAGE;
                                }
                                else
                                {
                                    HP -= PUNCHDAMAGE;
                                }
                                rightRumbleStrength = (int)PUNCHDAMAGE * 10;
                            }
                        }
                        break;
                    }

            }
        }
Exemple #2
0
 public void update(Combatant[] combatants,int numOfPlayers)
 {
     for(int i = 0;i < numOfPlayers;i++)
     {
         healthAndDrunkBuffers[i][0] = combatants[i].HP;
         healthAndDrunkBuffers[i][1] = combatants[i].DrunkBuffer;
     }
     this.numOfPlayers = numOfPlayers;
 }
Exemple #3
0
        public void loadCombatants(ContentManager content,string[] selectedCombatants, int numOfPlayers)
        {
            for (int i = 0; i < numOfPlayers; i++)
            {
                Combatant player = new Combatant(parent,this);
                player.loadCombatant(content, "Files/Combatants/"+ selectedCombatants[i]+ ".txt", (PlayerIndex)i);
                player.X = barX + (barWidth / 8 * i);
                player.Z = barY;
                player.LastX = barX + (barWidth / 8 * i);
                player.LastZ = barY;
                combatants.Add(player);

            }
            this.numOfPlayers = numOfPlayers;
        }