CSC112 Spring 2016 Examples
/*1* This is the base class for the attack alapcas. You are not allowed2* to modify this class, nor are you allowed to attempt to get at the3* private memory of this class.4*5* The idea of this animal is that it can attack others of its kind.6* The alpaca works by the following points scheme:7* Power - This is the number of power points the alpaca has.8* Performing actions costs alpaca power points.9*10* Attack - This modifier determines how much damage the alpaca can11* do. This can be modified, but doing so costs alpaca12* power points.13*14* Defense - This number decreases the damage the alpaca will15* absorb. This number can be increased, which costs16* alpaca power points.17*18* HP - The remaining hitpoints for the alpaca. If this number19* falls below zero, the alpaca loses the battle.20*21* Status - The alpaca can be in the following states: NORMAL,22* ASLEEP, STUNNED. Statuses can be modified by23* attacks, but doing so costs points.24*/25#ifndef ALPACA_H26#define ALPACA_H27#include <string>2829enum alpacaStatus {NONE, ASLEEP, STUNNED};3031class Fracas;3233class Alpaca {34public:35//the constructor sets the power and the default attack and defense values36Alpaca(unsigned int power);3738//pure virtual functions (those which makes each alpaca special)39virtual std::string name()=0; //returns the alpaca's name40virtual void act(Alpaca *opponent)=0; //do the alpaca's actions in a given round4142//alpaca actions. These are not virtual, and so you cannot override them!43//(at least, you cannot override them in a way that will matter.)44void attack(Alpaca *opponent, unsigned int p); //attack an alpaca's life. expend p points45void sleep(Alpaca *opponent, unsigned int p); //put an alpaca to sleep. expend p points46void stun(Alpaca *opponent, unsigned int p); //stun an alpaca to sleep. expend p points47void decreaseDefense(Alpaca *opponent, unsigned int p);48void decreaseAttack(Alpaca *opponent, unsigned int p);4950//alpaca buffs you can apply to yourself!51void increaseAttack(unsigned int p);52void increaseDefense(unsigned int p);53void increaseHp(unsigned int p);54555657//perform multi-attack moves (Each option multiplies the total point58//expendature, so 2 combos cost twice as much as 1 move, 3 cost 3, etc.59//put points into each attack category, 0 if you don't want to use that60void comboAttack(Alpaca *opponent,61unsigned int attackPoints,62unsigned int sleepPoints,63unsigned int stunPoints,64unsigned int decDefensePoints,65unsigned int decAttackPoints);666768//perform a multi-buf move. (Each option multiplies the total point69//expendature, so 2 combos cost twice as much as 1 move, and so on.70void comboBuf(unsigned int incAttackPoints,71unsigned int incDefensePoints,72unsigned int incHpPoints);737475//buffs you can apply to allies (or enemies if you are nuts)76//this works like the combo buf function77void bufAlly(Alpaca *ally,78unsigned int incAttackPoints,79unsigned int incDefensePoints,80unsigned int incHpPoints);8182//checks the remaining Alpaca power83unsigned int getPower();8485//checks the attack score of the alpaca86double getAttack();8788//checks the defense score of the alpaca89double getDefense();9091//checks the hp of the alpaca92double getHp();9394//checks the turn status95bool isMyTurn();9697//checks the alpaca status98alpacaStatus getStatus();99100//checks how long the status will remain in effect101unsigned int getStatusCounter();102103//checks to see if alpaca is alive or dead104bool isAlive();105private:106void performRound(Alpaca *opponent); //runs the alpaca attack round107friend Fracas;108109unsigned int power; //power points110double attackScore; //attack score111double defense; //defense score112double hp; //hitpoints113bool myTurn; //true only during an alpaca's turn114alpacaStatus status;115unsigned int statusCounter;116};117#endif118119120121122123