package com.bernard.greposimu.model;

import java.util.Set;

public class Heros {
	String nom;
	String pname;
	
	
	Set<String> appliedToNames;
	boolean appTerrestre,appNavale,appMythique;
	OffDefStats statsZero;
	OffDefStats statsPlus;
	
	
	
	public Heros(String nom, String pname, Set<String> appliedToNames, boolean appTerrestre, boolean appNavale, boolean appMythique,
			OffDefStats statsZero, OffDefStats statsPlus) {
		this.nom = nom;
		this.pname = pname;
		this.appliedToNames = appliedToNames;
		this.appTerrestre = appTerrestre;
		this.appNavale = appNavale;
		this.appMythique = appMythique;
		this.statsZero = statsZero;
		this.statsPlus = statsPlus;
	}



	public OffDefStats applyToUnit(Unite unite,int level) {
		if((appTerrestre && unite.terrestre) ||
				(appNavale && unite.navale) ||
				(appMythique && unite.mythique) ||
				appliedToNames.contains(unite.pname)) {
			return unite.stats.plus(unite.stats.prod(statsZero.plus(statsPlus.times(level))));
		}
		return unite.stats;
	}



	public String getNom() {
		return nom;
	}

	public String getPname() {
		return pname;
	}


	public Set<String> getAppliedToNames() {
		return appliedToNames;
	}



	public boolean isAppTerrestre() {
		return appTerrestre;
	}



	public boolean isAppNavale() {
		return appNavale;
	}



	public boolean isAppMythique() {
		return appMythique;
	}



	public OffDefStats getStatsZero() {
		return statsZero;
	}



	public OffDefStats getStatsPlus() {
		return statsPlus;
	}
	
	
}
