-
Notifications
You must be signed in to change notification settings - Fork 0
/
Monster.c
35 lines (31 loc) · 979 Bytes
/
Monster.c
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
#include "Core.h"
void SetMonster(Map *ThisMap, Monster *ThisMonster)
{
RandVPos(ThisMap, &ThisMonster->MonsterPos);
ThisMap->MapTile[ThisMonster->MonsterPos.X][ThisMonster->MonsterPos.Y].TileMob = ThisMonster;
ThisMap->MapTile[ThisMonster->MonsterPos.X][ThisMonster->MonsterPos.Y].IsWalk = 0;
}
void MonsterGen(Map *ThisMap, Monster *ThisMonster, short MonType)
{
ThisMonster->MonsterPos.X = 0;
ThisMonster->MonsterPos.Y = 0;
switch(MonType)
{
case 1: // A rat
ThisMonster->Health = getrand(7, 3);
ThisMonster->HitDam = getrand(3, 2);
ThisMonster->ToHit = getrand(30, 22);
ThisMonster->MonOut = 'r';
strcpy(ThisMonster->MonName, "Rat");
break;
}
SetMonster(ThisMap, ThisMonster);
ThisMonster->CurrHealth = ThisMonster->Health;
}
void MonsterDeath(Map *ThisMap, COORD MonPos)
{
ThisMap->MapTile[MonPos.X][MonPos.Y].TileMob = NULL;
RemoveObj(ThisMap, MonPos);
DrawMap(ThisMap);
//Item drop will be called here when it is implemented.
};