<commit_before>package org.egordorichev.lasttry.entity.enemy;

import org.egordorichev.lasttry.LastTry;
import org.egordorichev.lasttry.entity.*;
import org.egordorichev.lasttry.entity.player.Player;
import org.egordorichev.lasttry.graphics.Animation;
import org.egordorichev.lasttry.item.block.Block;
import org.egordorichev.lasttry.world.biome.Biome;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

public abstract class Enemy extends Entity {
    /**
     * Defined enemies
     */
    public static HashMap<Short, Class<? extends Enemy>> ENEMY_CACHE = new HashMap<>();

    /**
     * Max Ai for this enemy
     */
    protected static int maxAi;

    static {
        define(EnemyID.greenSlime, GreenSlime.class);
        define(EnemyID.blueSlime, BlueSlime.class);
        define(EnemyID.eyeOfCthulhu, EyeOfCthulhu.class);
        define(EnemyID.zombie, Zombie.class);

    }

    /**
     * Current Ai counter
     */
    protected int currentAi;
    /**
     * Enemy id
     */
    protected int id;
    /**
     * Enemy drops
     */
    protected List<Drop> drops = new ArrayList<>();
    /**
     * Animations
     */
    protected Animation[] animations;

    /**
     * Each biome has a maxinum number of enemies limit.  When deciding what enemy to spawn next in a biome, the
     * spawn weight of multiple enemies are added till the maximum number of enemies in the biome is complete.
     */
    private int spawnWeight;


    //TODO Should these parameters be replaced with an enum that encapsulates the stats?
    public Enemy(short id, int maxHp, int defense, int damage, int spawnWeight) {
        super(maxHp, damage, defense);

        this.animations = new Animation[State.values().length];
        this.id = id;
    }

    public Enemy(short id) {
        //TODO Should parameters be converted into an enum?
        //TODO Handle the 'spawnWeight' for a 'Boss' level enemy
        this(id, 10, 0, 5, 1);

        this.animations = new Animation[State.values().length];
        this.id = id;
    }

    public static void define(short id, Class<? extends Enemy> enemy) {
        // TODO: handle duplicates
        LastTry.debug("Defined [" + id + "] as " + enemy.getSimpleName());
        ENEMY_CACHE.put(id, enemy);
    }
<commit_msg>Forgot to store 'spawnWeight' variable - fix<commit_after>package org.egordorichev.lasttry.entity.enemy;

import org.egordorichev.lasttry.LastTry;
import org.egordorichev.lasttry.entity.*;
import org.egordorichev.lasttry.entity.player.Player;
import org.egordorichev.lasttry.graphics.Animation;
import org.egordorichev.lasttry.item.block.Block;
import org.egordorichev.lasttry.world.biome.Biome;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

public abstract class Enemy extends Entity {
    /**
     * Defined enemies
     */
    public static HashMap<Short, Class<? extends Enemy>> ENEMY_CACHE = new HashMap<>();

    /**
     * Max Ai for this enemy
     */
    protected static int maxAi;

    static {
        define(EnemyID.greenSlime, GreenSlime.class);
        define(EnemyID.blueSlime, BlueSlime.class);
        define(EnemyID.eyeOfCthulhu, EyeOfCthulhu.class);
        define(EnemyID.zombie, Zombie.class);

    }

    /**
     * Current Ai counter
     */
    protected int currentAi;
    /**
     * Enemy id
     */
    protected int id;
    /**
     * Enemy drops
     */
    protected List<Drop> drops = new ArrayList<>();
    /**
     * Animations
     */
    protected Animation[] animations;

    /**
     * Each biome has a maxinum number of enemies limit.  When deciding what enemy to spawn next in a biome, the
     * spawn weight of multiple enemies are added till the maximum number of enemies in the biome is complete.
     */
    private int spawnWeight;


    //TODO Should these parameters be replaced with an enum that encapsulates the stats?
    public Enemy(short id, int maxHp, int defense, int damage, int spawnWeight) {
        super(maxHp, damage, defense);
        this.spawnWeight = spawnWeight;
        this.animations = new Animation[State.values().length];
        this.id = id;
    }

    public Enemy(short id) {
        //TODO Should parameters be converted into an enum?
        //TODO Handle the 'spawnWeight' for a 'Boss' level enemy
        this(id, 10, 0, 5, 1);
        this.animations = new Animation[State.values().length];
        this.id = id;
    }

    public static void define(short id, Class<? extends Enemy> enemy) {
        // TODO: handle duplicates
        LastTry.debug("Defined [" + id + "] as " + enemy.getSimpleName());
        ENEMY_CACHE.put(id, enemy);
    }

{'fraction_non_alphanumeric': 0.10544437271357865, 'fraction_numerical': 0.002151925973746503, 'mean_word_length': 2.6772151898734178, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7388723', 'n_tokens_mistral': 1458, 'n_tokens_neox': 1396, 'n_words': 403}