MCPcopy Create free account
hub / github.com/TurningWheel/Barony / initSentryBot

Function initSentryBot

src/monster_sentrybot.cpp:30–270  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

28std::unordered_map<Uint32, int> gyroBotDetectedUids;
29
30void initSentryBot(Entity* my, Stat* myStats)
31{
32 node_t* node;
33
34 my->flags[BURNABLE] = false;
35 my->initMonster(my->sprite);
36 my->z = 0;
37
38 if ( multiplayer != CLIENT )
39 {
40 MONSTER_SPOTSND = 456;
41 MONSTER_SPOTVAR = 3;
42 MONSTER_IDLESND = -1;
43 MONSTER_IDLEVAR = 1;
44 }
45 if ( multiplayer != CLIENT && !MONSTER_INIT )
46 {
47 auto& rng = my->entity_rng ? *my->entity_rng : local_rng;
48
49 if ( myStats != nullptr )
50 {
51 if ( !myStats->leader_uid )
52 {
53 myStats->leader_uid = 0;
54 }
55
56 // apply random stat increases if set in stat_shared.cpp or editor
57 setRandomMonsterStats(myStats, rng);
58
59 // generate 6 items max, less if there are any forced items from boss variants
60 int customItemsToGenerate = ITEM_CUSTOM_SLOT_LIMIT;
61
62 // generates equipment and weapons if available from editor
63 createMonsterEquipment(myStats, rng);
64
65 // create any custom inventory items from editor if available
66 createCustomInventory(myStats, customItemsToGenerate, rng);
67
68 // count if any custom inventory items from editor
69 int customItems = countCustomItems(myStats); //max limit of 6 custom items per entity.
70
71 // count any inventory items set to default in edtior
72 int defaultItems = countDefaultItems(myStats);
73
74 //my->setHardcoreStats(*myStats);
75
76 if ( myStats->weapon == nullptr && my->sprite == 872/*&& myStats->EDITOR_ITEMS[ITEM_SLOT_WEAPON] == 1*/ )
77 {
78 myStats->weapon = newItem(CROSSBOW, EXCELLENT, 0, 1, MONSTER_ITEM_UNDROPPABLE_APPEARANCE, false, nullptr);
79 }
80 else if ( myStats->weapon == nullptr && my->sprite == 885/*&& myStats->EDITOR_ITEMS[ITEM_SLOT_WEAPON] == 1*/ )
81 {
82 if ( myStats->LVL >= 15 )
83 {
84 myStats->weapon = newItem(SPELLBOOK_MAGICMISSILE, EXCELLENT, 0, 1, MONSTER_ITEM_UNDROPPABLE_APPEARANCE, false, nullptr);
85 }
86 else
87 {

Callers 1

actMonsterFunction · 0.85

Calls 11

setRandomMonsterStatsFunction · 0.85
createMonsterEquipmentFunction · 0.85
createCustomInventoryFunction · 0.85
countCustomItemsFunction · 0.85
countDefaultItemsFunction · 0.85
newEntityFunction · 0.85
list_AddNodeLastFunction · 0.85
initMonsterMethod · 0.80
getUIDMethod · 0.80
newItemFunction · 0.70

Tested by

no test coverage detected