forked from CS162-Group35/GroupProject
-
Notifications
You must be signed in to change notification settings - Fork 0
/
paper.cpp
39 lines (36 loc) · 1.26 KB
/
paper.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
/******************************************************************************
* Authors: Sean Patrick Akins
* Edmund Dea
* Trevor Rollins
* Nathan Villegas
* Group: 35
* Class: CS162-400
* Date: 10/27/2017
* Title: Group Project
* Description: Defines the paper class
******************************************************************************/
#include "paper.hpp"
/******************************************************************************
* Function: Paper
* Arguments: N/A
* Description: Default constructor for the Paper class
******************************************************************************/
Paper::Paper() : Tool ()
{
Tool::setStrength(1);
Tool::setType('p');
}
/******************************************************************************
* Function: fight
* Arguments: Tool opponentChoice
* Description: Handles paper fighting against the opponent's Tool
******************************************************************************/
int Paper::fight(Tool opponentChoice)
{
if(opponentChoice.getType() == 's')
return (Tool::getStrength() / 2);
else if (opponentChoice.getType() == 'r')
return (Tool::getStrength() * 2);
else
return Tool::getStrength();
}