summaryrefslogtreecommitdiffstats
path: root/src/Mobs/Witch.cpp
blob: 43edf4b43ba6df3da7b9c72acc4501df9f10dee1 (plain) (blame)
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

#include "Globals.h"  // NOTE: MSVC stupidness requires this to be the same across all modules

#include "Witch.h"
#include "FastRandom.h"





cWitch::cWitch(void) :
	super(mtWitch, "entity.witch.hurt", "entity.witch.death", 0.6, 1.8)
{
	m_EMPersonality = AGGRESSIVE;
	m_BehaviorDoNothing.AttachToMonster(*this);
	GetMonsterConfig("Witch");
}





void cWitch::GetDrops(cItems & a_Drops, cEntity * a_Killer)
{
	unsigned int LootingLevel = 0;
	if (a_Killer != nullptr)
	{
		LootingLevel = a_Killer->GetEquippedWeapon().m_Enchantments.GetLevel(cEnchantments::enchLooting);
	}
	auto & r1 = GetRandomProvider();
	int DropTypeCount = r1.RandInt(1, 3);
	for (int i = 0; i < DropTypeCount; i++)
	{
		int DropType = r1.RandInt(6);
		switch (DropType)
		{
			case 0: AddRandomDropItem(a_Drops, 0, 2 + LootingLevel, E_ITEM_GLASS_BOTTLE); break;
			case 1: AddRandomDropItem(a_Drops, 0, 2 + LootingLevel, E_ITEM_GLOWSTONE_DUST); break;
			case 2: AddRandomDropItem(a_Drops, 0, 2 + LootingLevel, E_ITEM_GUNPOWDER); break;
			case 3: AddRandomDropItem(a_Drops, 0, 2 + LootingLevel, E_ITEM_REDSTONE_DUST); break;
			case 4: AddRandomDropItem(a_Drops, 0, 2 + LootingLevel, E_ITEM_SPIDER_EYE); break;
			case 5: AddRandomDropItem(a_Drops, 0, 2 + LootingLevel, E_ITEM_STICK); break;
			case 6: AddRandomDropItem(a_Drops, 0, 2 + LootingLevel, E_ITEM_SUGAR); break;
		}
	}
	AddRandomWeaponDropItem(a_Drops, LootingLevel);
}