Prevents artifacts before level 3

- Also fixes a potential segfault
This commit is contained in:
Linus Probert 2018-08-15 18:16:44 +02:00
parent 8fa4fbd51c
commit 3fabd039a4
2 changed files with 2 additions and 2 deletions

View File

@ -96,7 +96,7 @@ artifact_create_random(Player *p, Uint8 level)
{
int option = -1;
if (p->stats.lvl >= 4)
option = get_random(LAST_ARTIFACT_EFFECT);
option = get_random(LAST_ARTIFACT_EFFECT - 1);
else if (p->stats.lvl >= 3)
option = get_random(INCREASED_STUN);
else

View File

@ -542,7 +542,7 @@ monster_drop_loot(Monster *monster, Map *map, Player *player)
linkedlist_append(&map->items, treasure);
}
if (get_random(19) == 0) {
if (monster->stats.lvl > 2 && get_random(19) == 0) {
Artifact *a = artifact_create_random(player, 1);
a->sprite->pos = monster->sprite->pos;
linkedlist_append(&map->artifacts, a);