package net.asrex.skillful.requirement;

import java.util.logging.Logger;
import lombok.Data;
import net.asrex.skillful.PlayerSkillInfo;
import net.asrex.skillful.skill.Skill;
import net.asrex.skillful.util.Log;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.EnumChatFormatting;

/**
 * A perk requirement that checks for a certain skill level.
 */
@Data
public class SkillRequirement implements Requirement {

	private static final Logger log = Log.get(SkillRequirement.class);
	
	private String skill;
	private int level;
	
	@Override
	public boolean satisfied(EntityPlayer player, PlayerSkillInfo info) {
		if (skill == null) {
			log.warning("Skill not specified in skill requirement!");
			return true;
		}
		
		Skill s = info.getSkill(skill);
		if (s == null) {
			return false;
		}
		
		return s.getLevel() >= level;
	}
	
	@Override
	public String describe() {
		return String.format(
				"Skill: Min. %s%s%s level: %s%d%s",
				EnumChatFormatting.DARK_GREEN,
				skill,
				EnumChatFormatting.RESET,
				
				EnumChatFormatting.GOLD,
				level,
				EnumChatFormatting.RESET);
	}
	
}

@@ -169,16 +169,60 @@
 .Skill;%0A
+import net.asrex.skillful.util.Conditional;%0A
 import n
@@ -249,16 +249,16 @@
 il.Log;%0A
-
 import n
@@ -589,16 +589,64 @@
  level;%0A
+%09private Conditional is = Conditional.at_least;%0A
 %09%0A%09@Over
@@ -914,16 +914,27 @@
 %09return 
+is.compare(
 s.getLev
@@ -941,17 +941,16 @@
 el()
- %3E=
+,
  level
+)
 ;%0A%09%7D

Add conditional support to SkillRequirement