Base code

This commit is contained in:
Aelita4 2022-05-17 14:02:39 +02:00
parent fefc90006f
commit 92dd81cdaa
1 changed files with 46 additions and 1 deletions

View File

@ -1,8 +1,53 @@
#include <iostream>
#include <vector>
using namespace std;
struct Params {
int life = 3;
int movement = 4;
int pos[2];
};
class Enemy: protected Params {
virtual void move() {};
friend void killAi(Enemy);
};
template <class TT>
class Palladin : public Enemy {
TT stamina;
string weapon = "sword";
int mana = 10;
public:
void move(int x, int y) {
if (movement > x && movement > y) {
pos[0] = x;
pos[1] = y;
}
}
};
void killAi(Enemy e) {
e.life = 0;
}
template <class TTTT>
TTTT upgradeAi(TTTT e) {
return e;
}
int main()
{
cout << "Hello World!\n";
Palladin<vector<int>> jerzy;
Enemy kretoszczur;
jerzy.move(1, 1);
killAi(jerzy);
killAi(kretoszczur);
upgradeAi(jerzy);
upgradeAi(kretoszczur);
upgradeAi("kolonia");
}