-
Notifications
You must be signed in to change notification settings - Fork 0
/
DamageCalc.cpp
141 lines (139 loc) · 2.92 KB
/
DamageCalc.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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
// Made for Mario Paintasy (MPXVI)
// (c) 2009 by RehdBlob
// Version 4.0
#include <iostream.h>
#include <stdlib.h>
#include <time.h>
int main()
{
int restart = 1;
int totnetdamage, percent;
double spattack, atk, spatklvl;
double coredamage, attack, defense, damage, netdamage;
srand(time(NULL));
while (restart > 0)
{
system("CLS");
cout << "Special Attack or Regular Attack?" << endl;
cout << "(1) Regular" << endl << "(2) Special" << endl;
cin >> atk;
if (atk == 1)
{
cout << "Type in your level" << endl;
cout << "/rolldie " ;
cin >> percent;
coredamage = rand() % percent + 1;
cout << "Rolldie resulted in: " << coredamage << endl;
cout <<"What is your attack?"<<endl<<"(1)Medium"<<endl<<"(2)High"<<endl;
cout <<"(3)Low"<<endl;
cin >> attack;
if (attack == 1)
{
damage = coredamage;
}
if (attack == 2)
{
damage = 1.5 * coredamage;
}
if (attack == 3)
{
damage = 0.5 * coredamage;
}
cout <<"What is the enemy's defense?"<<endl<<"(1)Medium"<<endl<<"(2)High"<<endl;
cout <<"(3)Low"<<endl<<"(4)The enemy is weak to my type of attack"<<endl;
cout <<"(5)The enemy is resistant to my type of attack"<<endl;
cin >> defense;
if (defense == 1)
{
netdamage = damage;
}
if (defense == 2)
{
netdamage = 0.5 * damage;
}
if (defense == 3)
{
netdamage = 1.5 * damage;
}
if (defense == 4)
{
netdamage = 1.5 * damage;
}
if (defense == 5)
{
netdamage = 0.5 * damage;
}
totnetdamage = netdamage + 0.75;
cout << "The damage dealt is " << totnetdamage << " ." << endl;
}
else if (atk == 2)
{
cout << "Special Attack: " << endl << "(1) Medium";
cout << endl << "(2) High" << endl << "(3) Low" << endl;
cin >> spattack;
cout << "Level Skill was learned at: ";
cin >> spatklvl;
attack = spattack;
if (spattack == 3)
{
spattack = 0.5;
}
int special = spattack * spatklvl + 0.5;
cout << special << " is the amount you need to put into '/rolldie' " << endl;
cout << "/rolldie " ;
cin >> percent;
coredamage = rand() % percent + 1;
cout << "Rolldie resulted in: " << coredamage << endl;
if (attack == 1)
{
damage = coredamage;
}
if (attack == 2)
{
damage = 1.5 * coredamage;
}
if (attack == 3)
{
damage = 0.5 * coredamage;
}
cout <<"What is the enemy's defense?"<<endl<<"(1)Medium"<<endl<<"(2)High"<<endl;
cout <<"(3)Low"<<endl<<"(4)The enemy is weak to my type of attack"<<endl;
cout <<"(5)The enemy is resistant to my type of attack"<<endl;
cin >> defense;
if (defense == 1)
{
netdamage = damage;
}
if (defense == 2)
{
netdamage = 0.5 * damage;
}
if (defense == 3)
{
netdamage = 1.5 * damage;
}
if (defense == 4)
{
netdamage = 1.5 * damage;
}
if (defense == 5)
{
netdamage = 0.5 * damage;
}
totnetdamage = netdamage + 0.75;
cout << "The damage dealt is " << totnetdamage << " ." << endl;
}
cout << "Do another damage calculation?"<<endl<<"(1)Yes"<<endl<<"(2)No"<<endl;
cin >> restart;
if (restart == 1)
{
restart = 1;
}
else
{
restart = 0;
}
}
system("PAUSE");
return 0;
}