// Compiled by ClojureScript 1.10.520 {}
goog.provide('weathergen.damage');
goog.require('cljs.core');
goog.require('clojure.string');
goog.require('weathergen.falcon.files.mission');
/**
 * Returns a table of the number of hits needed to destroy each feature
 *   at an objective. `weapon` is the weapon to
 *   include. `objective` is the objective.
 */
weathergen.damage.required_hits = (function weathergen$damage$required_hits(mission,objective,weapon){
var iter__4523__auto__ = (function weathergen$damage$required_hits_$_iter__29718(s__29719){
return (new cljs.core.LazySeq(null,(function (){
var s__29719__$1 = s__29719;
while(true){
var temp__5720__auto__ = cljs.core.seq.call(null,s__29719__$1);
if(temp__5720__auto__){
var s__29719__$2 = temp__5720__auto__;
if(cljs.core.chunked_seq_QMARK_.call(null,s__29719__$2)){
var c__4521__auto__ = cljs.core.chunk_first.call(null,s__29719__$2);
var size__4522__auto__ = cljs.core.count.call(null,c__4521__auto__);
var b__29721 = cljs.core.chunk_buffer.call(null,size__4522__auto__);
if((function (){var i__29720 = (0);
while(true){
if((i__29720 < size__4522__auto__)){
var vec__29722 = cljs.core._nth.call(null,c__4521__auto__,i__29720);
var index = cljs.core.nth.call(null,vec__29722,(0),null);
var feature = cljs.core.nth.call(null,vec__29722,(1),null);
cljs.core.chunk_append.call(null,b__29721,(function (){var fci = new cljs.core.Keyword("weathergen.falcon.files.mission","feature-class-info","weathergen.falcon.files.mission/feature-class-info",1346129647).cljs$core$IFn$_invoke$arity$1(new cljs.core.Keyword("weathergen.falcon.files.mission","class-info","weathergen.falcon.files.mission/class-info",-1092492204).cljs$core$IFn$_invoke$arity$1(feature));
var feature_name = new cljs.core.Keyword(null,"name","name",1843675177).cljs$core$IFn$_invoke$arity$1(fci);
var feature_value = new cljs.core.Keyword(null,"value","value",305978217).cljs$core$IFn$_invoke$arity$1(feature);
var virtual_QMARK_ = new cljs.core.Keyword(null,"virtual?","virtual?",1554264002).cljs$core$IFn$_invoke$arity$1(new cljs.core.Keyword(null,"flags","flags",1775418075).cljs$core$IFn$_invoke$arity$1(fci));
var hit_points = new cljs.core.Keyword(null,"hit-points","hit-points",-906296276).cljs$core$IFn$_invoke$arity$1(fci);
var damage_mods = new cljs.core.Keyword(null,"damage-mod","damage-mod",-756867116).cljs$core$IFn$_invoke$arity$1(fci);
var weapon_name = new cljs.core.Keyword(null,"name","name",1843675177).cljs$core$IFn$_invoke$arity$1(weapon);
var damage_type = new cljs.core.Keyword(null,"damage-type","damage-type",898770578).cljs$core$IFn$_invoke$arity$1(weapon);
var damage_strength = new cljs.core.Keyword(null,"strength","strength",-415606478).cljs$core$IFn$_invoke$arity$1(weapon);
var damage_mod = cljs.core.nth.call(null,damage_mods,damage_type);
var hits_required = (hit_points / ((damage_strength / 100.0) * damage_mod));
return new cljs.core.PersistentArrayMap(null, 7, [new cljs.core.Keyword(null,"index","index",-1531685915),(index + (1)),new cljs.core.Keyword(null,"feature-value","feature-value",-369211338),feature_value,new cljs.core.Keyword(null,"feature-name","feature-name",676033148),feature_name,new cljs.core.Keyword(null,"hit-points","hit-points",-906296276),hit_points,new cljs.core.Keyword(null,"resistance","resistance",-1289779601),damage_mod,new cljs.core.Keyword(null,"virtual?","virtual?",1554264002),virtual_QMARK_,new cljs.core.Keyword(null,"hits-required","hits-required",-766872875),hits_required], null);
})());

var G__29728 = (i__29720 + (1));
i__29720 = G__29728;
continue;
} else {
return true;
}
break;
}
})()){
return cljs.core.chunk_cons.call(null,cljs.core.chunk.call(null,b__29721),weathergen$damage$required_hits_$_iter__29718.call(null,cljs.core.chunk_rest.call(null,s__29719__$2)));
} else {
return cljs.core.chunk_cons.call(null,cljs.core.chunk.call(null,b__29721),null);
}
} else {
var vec__29725 = cljs.core.first.call(null,s__29719__$2);
var index = cljs.core.nth.call(null,vec__29725,(0),null);
var feature = cljs.core.nth.call(null,vec__29725,(1),null);
return cljs.core.cons.call(null,(function (){var fci = new cljs.core.Keyword("weathergen.falcon.files.mission","feature-class-info","weathergen.falcon.files.mission/feature-class-info",1346129647).cljs$core$IFn$_invoke$arity$1(new cljs.core.Keyword("weathergen.falcon.files.mission","class-info","weathergen.falcon.files.mission/class-info",-1092492204).cljs$core$IFn$_invoke$arity$1(feature));
var feature_name = new cljs.core.Keyword(null,"name","name",1843675177).cljs$core$IFn$_invoke$arity$1(fci);
var feature_value = new cljs.core.Keyword(null,"value","value",305978217).cljs$core$IFn$_invoke$arity$1(feature);
var virtual_QMARK_ = new cljs.core.Keyword(null,"virtual?","virtual?",1554264002).cljs$core$IFn$_invoke$arity$1(new cljs.core.Keyword(null,"flags","flags",1775418075).cljs$core$IFn$_invoke$arity$1(fci));
var hit_points = new cljs.core.Keyword(null,"hit-points","hit-points",-906296276).cljs$core$IFn$_invoke$arity$1(fci);
var damage_mods = new cljs.core.Keyword(null,"damage-mod","damage-mod",-756867116).cljs$core$IFn$_invoke$arity$1(fci);
var weapon_name = new cljs.core.Keyword(null,"name","name",1843675177).cljs$core$IFn$_invoke$arity$1(weapon);
var damage_type = new cljs.core.Keyword(null,"damage-type","damage-type",898770578).cljs$core$IFn$_invoke$arity$1(weapon);
var damage_strength = new cljs.core.Keyword(null,"strength","strength",-415606478).cljs$core$IFn$_invoke$arity$1(weapon);
var damage_mod = cljs.core.nth.call(null,damage_mods,damage_type);
var hits_required = (hit_points / ((damage_strength / 100.0) * damage_mod));
return new cljs.core.PersistentArrayMap(null, 7, [new cljs.core.Keyword(null,"index","index",-1531685915),(index + (1)),new cljs.core.Keyword(null,"feature-value","feature-value",-369211338),feature_value,new cljs.core.Keyword(null,"feature-name","feature-name",676033148),feature_name,new cljs.core.Keyword(null,"hit-points","hit-points",-906296276),hit_points,new cljs.core.Keyword(null,"resistance","resistance",-1289779601),damage_mod,new cljs.core.Keyword(null,"virtual?","virtual?",1554264002),virtual_QMARK_,new cljs.core.Keyword(null,"hits-required","hits-required",-766872875),hits_required], null);
})(),weathergen$damage$required_hits_$_iter__29718.call(null,cljs.core.rest.call(null,s__29719__$2)));
}
} else {
return null;
}
break;
}
}),null,null));
});
return iter__4523__auto__.call(null,cljs.core.map_indexed.call(null,cljs.core.vector,new cljs.core.Keyword("weathergen.falcon.files.mission","features","weathergen.falcon.files.mission/features",534334694).cljs$core$IFn$_invoke$arity$1(objective)));
});
