public void SetSkill(StatBit statbit) { SpecialSkill s = _getSkill(statbit.effect_type); if (s == null) { Debug.Log("Skillmaster does not have a skill of type " + statbit.effect_type + "\n"); return; } if (!statbit.hasStat()) { Debug.Log("Setting null skill?\n"); return; } // Debug.Log("Setting skill " + statbit.effect_type + "\n"); s.Skill = statbit; //.GetClone();//should this be a clone or no? s.button.SetSkill(); my_panel.UpdatePanel(); // castle skills are always active but are still set up through buttons. To actually have the skill go off, have to simulate the click. //Architect = do it now, skill is always present //Renew = Regenerate_fake_button fake clicks when health goes down if (Get.isCastleSkill(statbit.effect_type) && CheckSkill(statbit.effect_type)) { s.button.selected = false; if (statbit.effect_type == EffectType.Architect) { s.button.OnClick(); } } }
public float[] getModifiedPrimaryStats(float defense) { switch (runetype) { case RuneType.Sensible: //diffuse damage is set by factors return(GetStatBit(EffectType.Force).getModifiedStats(factor, defense)); case RuneType.Airy: return(GetStatBit(EffectType.Speed).getModifiedStats(factor, defense)); case RuneType.Vexing: //rapid fire damage set is by modifying arrow statsum directly float[] damage = GetStatBit(EffectType.VexingForce).getModifiedStats(factor, defense); StatBit extra = GetStatBit(EffectType.Focus); //if (extra != null && extra.Level > 0) damage[0] += extra.getModifiedStats(factor, defense)[1]; if (extra != null && extra.Level > 0) { damage[0] = extra.getModifiedStats(factor, defense)[1]; } return(damage); } return(new float[0]); }
public float getReloadTime(bool basic) { float reload_time = GetStatBit(EffectType.ReloadTime).getStats()[0]; if (!basic) { if (runetype == RuneType.Vexing) { StatBit extra = GetStatBit(EffectType.Focus); if (extra != null) { reload_time += extra.getStats()[2]; } } if (runetype == RuneType.Sensible) { StatBit extra = GetStatBit(EffectType.Diffuse); if (extra != null) { reload_time += extra.getStats()[4]; } } } return(reload_time); }
//CALAMITY public void Init(StatBit bit, HitMe target, Firearm firearm, EffectType type) { Prepare(bit, firearm, type); if (type == EffectType.Calamity) { my_lava = Peripheral.Instance.zoo.getObject("Wishes/calamity_lava", true).GetComponent <Lava>(); } else { my_lava = Peripheral.Instance.zoo.getObject("Wishes/foil_lava", true).GetComponent <Lava>(); } my_lava.auto_return = true; my_lava.my_firearm = firearm; my_lava.Init(type, bit.level, lava_stats, lava_timer, true, firearm); my_lava.SetLocation(target.transform, target.transform.position, lava_size, Quaternion.identity); my_lava.SetFactor(1); my_lava.transform.localPosition = Vector3.zero; Vector3 pos = my_lava.transform.position; pos.z = 3.75f; my_lava.transform.position = pos; my_lava.updateMyPosition = true; target.lavas.Add(my_lava); }
public float getRange() { StatBit sb = GetStatBit(EffectType.Range); if (sb == null) { return(-2); } float range = sb.getStats()[0]; if (runetype == RuneType.Vexing) { StatBit extra = GetStatBit(EffectType.Focus); if (extra != null && extra.Level > 0) { range += extra.getStats()[0]; } extra = GetStatBit(EffectType.RapidFire); if (extra != null && extra.Level > 0) { range += extra.getStats()[4]; } } return(range); }
public override void Activate(StatBit skill) { float[] _stats = skill.getStats(); level = skill.level; am_active = true; my_firearm = Peripheral.Instance.getHeroFirearm(RuneType.Airy); my_line.gameObject.SetActive(true); collider.enabled = true; StatBit[] sb = new StatBit[2]; sb[0] = new StatBit(EffectType.Speed, _stats[0], 1, false); sb[0].effect_sub_type = EffectSubType.Freeze; sb[0].very_dumb = true; sb[0].dumb = true; sb[1] = new StatBit(EffectType.Force, _stats[1], 1, false); sb[1].very_dumb = true; sb[1].dumb = true; Debug.Log("Activating Quicksand! Speed " + _stats[0] + " force " + _stats[1] + "\n"); if (Monitor.Instance != null) { Monitor.Instance.my_spyglass.DisableByDragButton(true); } stats = new StatSum(3, 0, sb, RuneType.Airy); //stats doesn't have a factor because of speed bullets = Mathf.CeilToInt(_stats[3]); stats.factor = 1; lava_life = _stats[2]; lava_size = _stats[5]; my_line.clearLine(); }
public void loadSnapshot(RuneSaver saver) { runetype = saver.runetype; toy_type = saver.toy_type; invested_cost = saver.invested_cost; ID = saver.ID; level = saver.level; xp = saver.xp; distance_bonus = saver.distance_bonus; order = saver.order; if (saver.max_level < 0) { saver.max_level = 0; } int max_level = Mathf.Max(saver.max_level, LevelStore.getMaxLevel(Central.Instance.current_lvl, Peripheral.Instance.difficulty, runetype, toy_type)); setMaxLevel(max_level); Sun.OnDayTimeChange += OnDayTimeChange; StaticRune.assignStatBits(ref stats, this); foreach (StatBitSaver s in saver.stats) { StatBit stat = getStat(s.effect_type); stat.loadSnapshot(s, this); } UpdateTimeOfDay(); setXpReqs(); UpdateStats(); }
public void DoSpecialThing(EffectType type) { StatBit g = special_stat_sum.GetStatBit(type); if (g == null) { return; } if (g.level == 0) { return; } // Debug.Log("Doing special thing " + type + "\n"); switch (type) { case EffectType.Speed: Upgrade(EffectType.Force, false); break; default: // Debug.Log("Rune doing special thing " + type + "\n"); Peripheral.Instance.my_skillmaster.SetSkill(g); break; } }
public void setInfoLabel(MyLabel label, Rune check_rune) { StatSum statsum = (check_rune != null) ? check_rune.GetStats(Get.isSpecial(label.effect_type)) : null; StatBit statbit = (statsum != null) ? statsum.GetStatBit(label.effect_type) : null; if (label.text != null) { label.text.text = ""; } if (label.image_labels.Length > 0) { label.image_labels[0].setLabel("", 0); } if (statbit != null && statbit.hasStat()) { int lvl = check_rune.getLevel(label.effect_type); if (label.text != null) { label.text.text = (lvl > 0) ? lvl.ToString() : ""; } if (label.image_labels.Length > 0) { label.image_labels[0].setLabel("", lvl); } } }
public override void Activate(StatBit skill) { float[] _stats = skill.getStats(); level = skill.level; am_active = true; my_firearm = Peripheral.Instance.getHeroFirearm(RuneType.Sensible); my_line.gameObject.SetActive(true); collider.enabled = true; StatBit[] sb = new StatBit[1]; //sb[0] = new StatBit(EffectType.Force, _stats[0], 1, false); sb[0] = new StatBit(EffectType.Force, _stats[0], 1, false); lava_life = _stats[1];// / 5f; sb[0].very_dumb = true; bullets = Mathf.CeilToInt(_stats[2]); if (Monitor.Instance != null) { Monitor.Instance.my_spyglass.DisableByDragButton(true); } stats = new StatSum(1, 0, sb, RuneType.Sensible); stats.factor = 1;// / (lava_life * lava_size); // Debug.Log("Activating Air Attack! Damage " + _stats[0] + " factor " + stats.factor + " bullets " + bullets + " lava_life " + lava_life + "\n"); my_line.clearLine(); }
public StatSum getSubStatSum(EffectType type) { int actives = 0; for (int i = 0; i < stats.Length; i++) { if (stats[i].effect_type == type) { actives++; } } int my_i = 0; StatBit[] my_stats = new StatBit[actives]; for (int i = 0; i < stats.Length; i++) { if (stats[i].effect_type != type) { continue; } //my_stats[my_i] = new StatBit(stats[i].type, stats[i].stat, stats[i].recharge_time,stats[i].isGeneric); my_stats[my_i] = stats[i].clone(); my_i++; } return(new StatSum(level, xp, my_stats, runetype)); }
public override void Activate(StatBit skill) { float[] _stats = skill.getStats(); level = skill.level; my_firearm = Peripheral.Instance.getHeroFirearm(RuneType.Sensible); am_active = true; collider.enabled = true; speed = _stats[2]; lava_size = _stats[4]; lava_life = _stats[1];// / 5f; StatBit[] sb = new StatBit[2]; sb[0] = new StatBit(EffectType.Force, _stats[0], 1, false); sb[0].very_dumb = true; sb[0].dumb = true; sb[1] = new StatBit(EffectType.Stun, speed, 1, false); sb[1].very_dumb = true; sb[1].dumb = true; if (Monitor.Instance != null) { Monitor.Instance.my_spyglass.DisableByDragButton(true); } stats = new StatSum(1, 0, sb, RuneType.Sensible); stats.factor = 1; }
void CheckIfRapidFireSkill() { if (toy.rune.runetype == RuneType.Vexing && toy.rune.getLevel(EffectType.RapidFire) > 0) { InitRapidFire(); StatBit rf = toy.rune.getStatBit(EffectType.RapidFire); rapid_fire.Init(rf.getStats(), toy.rune.get(EffectType.VexingForce), rf.level); } }
public StatSum clone() { StatBit[] my_stats = new StatBit[stats.Length]; for (int i = 0; i < stats.Length; i++) { my_stats[i] = stats[i].clone(); } return(new StatSum(level, xp, my_stats, runetype)); }
public StatBit getStatBit(EffectType type) { StatBit b = stat_sum.GetStatBit(type); if (b == null) { b = special_stat_sum.GetStatBit(type); } return(b); }
public void UpdateStats() { // Debug.Log("Updating stats " + stats.Length + "\n"); int actives = 0; int special_actives = 0; if (stats == null) { return; } for (int i = 0; i < stats.Length; i++) { bool special = Get.isSpecial(stats[i].effect_type); stats[i].checkFinisher(); if (stats[i].active && special) { special_actives++; } if (stats[i].active && !special) { actives++; } } int my_i = 0; int my_special_i = 0; StatBit[] my_stats = new StatBit[actives]; StatBit[] my_special_stats = new StatBit[special_actives]; float current_time_bonus = StaticRune.GetTimeBonus(runetype, toy_type); for (int i = 0; i < stats.Length; i++) { stats[i].setModifier(current_time_bonus, distance_bonus); if (!stats[i].active) { continue; } bool special = Get.isSpecial(stats[i].effect_type); if (special) { my_special_stats[my_special_i] = stats[i]; my_special_i++; } else { my_stats[my_i] = stats[i]; my_i++; } } stat_sum = new StatSum(level, xp, my_stats, runetype); special_stat_sum = new StatSum(level, xp, my_special_stats, runetype); }
void UpdatePassiveLabels() { foreach (MyLabel l in drivers[current_driver].labels) { if (!l.type.Equals("info")) { continue; } MyText level_text = l.getText(LabelName.Level); MyText cost_text = l.getText(LabelName.UpgradeCost); if (level_text == null && cost_text == null) { return; } Rune r = ((Toy_Button)l.ui_button).toy_rune; setInfoLabel(l, r); if (r == null) { if (level_text != null) { level_text.setText(""); } if (cost_text != null) { cost_text.setText(""); } continue; } StatBit s = r.getStat(l.effect_type); if (s == null) { if (level_text != null) { level_text.setText(""); } if (cost_text != null) { cost_text.setText(""); } continue; } if (level_text != null) { level_text.setText((s.Level > 0)? s.Level.ToString(): ""); } if (cost_text != null) { cost_text.setText(s.cost.Amount.ToString()); } } }
public override void Activate(StatBit skill) { float[] _stats = skill.getStats(); level = skill.level; my_firearm = Peripheral.Instance.getHeroFirearm(RuneType.Airy); stats = _stats; am_active = true; collider.enabled = true; // Debug.Log("plaguesummoner activated\n"); }
public void setInfo(bool show) { info = false; info_panel.SetActive(show); if (show) { StatSum statsum = parent.rune.GetStats(false); for (int i = 0; i < labels.Count; i++) { //Debug.Log("Checking label " + labels[i].effect_type + "\n"); StatBit statbit = statsum.GetStatBit(labels[i].effect_type); if (Get.isGeneric(statbit.effect_type) && statbit.hasStat()) { if (labels[i].type.Equals("info")) { labels[i].text.text = statbit.getDetailStats()[0].toString(); info = true; // Debug.Log("updating text for " + labels[i].effect_type + "\n"); } else { labels[i].gameObject.SetActive(true); info = true; //Debug.Log("updating image for " + labels[i].effect_type + "\n"); } } else if (statbit.hasStat()) { if (labels[i].type.Equals("info")) { labels[i].text.text = statbit.getDetailStats()[0].toString(); info = true; labels[i].gameObject.SetActive(true); // Debug.Log("updating text for " + labels[i].effect_type + "\n"); } else { labels[i].gameObject.SetActive(true); info = true; // Debug.Log("updating image for " + labels[i].name + " " + labels[i].effect_type + "\n"); } } else { labels[i].gameObject.SetActive(false); } } } }
void SetEverythingOnFire(float[] stats) /// DOT FINISHER { my_lava = Zoo.Instance.getObject(lava_name, false).GetComponent <Lava>(); //my_lava.SetLocation(this.transform, this.transform.position, stats[1], Quaternion.identity); StatBit[] lava_statbits = new StatBit[1]; lava_statbits[0] = new StatBit(EffectType.Fear, stats[0], 1, true); StatSum lava_stats = new StatSum(1, 0, lava_statbits, RuneType.Vexing); my_lava.SetLocation(my_hitme.transform, my_hitme.transform.position, stats[1], Quaternion.identity); my_lava.Init(EffectType.DOT, 2, lava_stats, duration, true, null); my_lava.gameObject.SetActive(true); }
public override void Activate(StatBit skill) { castle = Peripheral.Instance.castle; castle_position = castle.transform.position; float[] _stats = skill.getStats(); rate = _stats[0]; frequency = _stats[1]; am_active = true; StopAllCoroutines(); StartCoroutine(Fire()); }
public void modifyArrow(Arrow arrow) { arrow.speed = GetSpeed(); // arrow.type.factor = damage_multiplier; StatBit vf = arrow.type.GetStatBit(EffectType.VexingForce); vf.dumb = true; vf.level = level; vf.Base_stat *= damage_multiplier; vf.very_dumb = true; }
public void initStats(StatBit skill, int ID) { float[] stats = skill.getStats(); bullets = Mathf.RoundToInt(stats[0]); fire_time = stats[1]; // if (!am_firing) { my_statsum = new StatSum(); my_statsum.towerID = ID; my_statsum.runetype = RuneType.Sensible; StatBit[] statbits; float finisher_percent = (stats.Length == StaticStat.StatLength(EffectType.Sparkles, true)) ? stats[3] : 0; if (finisher_percent > 0 && UnityEngine.Random.Range(0, 1) < finisher_percent) { statbits = new StatBit[3]; statbits[2] = new StatBit(); statbits[2].effect_type = EffectType.Sparkles; statbits[2].Base_stat = stats[4]; statbits[2].level = skill.level; } else { statbits = new StatBit[2]; } statbits[0] = new StatBit(); statbits[0].effect_type = EffectType.Force; statbits[1] = new StatBit(); statbits[1].effect_type = EffectType.Range; statbits[1].Base_stat = 1.5f + skill.level / 2f; my_statsum.stats = statbits; // } //lets_make_sparkles = false; my_statsum.stats[0].Base_stat = stats[2]; my_statsum.stats[0].dumb = true; my_statsum.stats[0].very_dumb = true; my_statsum.stats[0].level = skill.level; //this works like a lava am_firing = true; is_active = true; if (colors == null) { InitColors(); } }
public override void Activate(StatBit skill) { castle = Peripheral.Instance.castle; float[] _stats = skill.getStats(); percent = _stats[0]; am_active = true; Central.Instance.base_toy_cost_mult = Get.getPercent(percent); Central.Instance.updateCost(Peripheral.Instance.getToys()); am_active = true; }
void CauseMassPanic(float[] stats) { my_lava = Zoo.Instance.getObject(lava_name, false).GetComponent <Lava>(); StatBit[] lava_statbits = new StatBit[1]; lava_statbits[0] = new StatBit(EffectType.Fear, stats[0], 0, true); StatSum lava_stats = new StatSum(1, 0, lava_statbits, RuneType.Vexing); my_lava.SetLocation(my_ai.transform, my_ai.transform.position, stats[1], Quaternion.identity); my_lava.lifespan = stats[0]; //not ideal, level is whaaaat my_lava.Init(EffectType.Fear, 2, lava_stats, lifetime, true, null); my_lava.gameObject.SetActive(true); }
public StatSum cloneAndRemoveStat(EffectType t) { StatBit[] my_stats = new StatBit[stats.Length - 1]; int ix = 0; for (int i = 0; i < stats.Length; i++) { if (stats[i].effect_type == t) { continue; } my_stats[ix] = stats[i].clone(); ix++; } return(new StatSum(level, xp, my_stats, runetype)); }
public override void Activate(StatBit skill) { float[] _stats = skill.getStats(); level = skill.level; collider.enabled = true; my_firearm = Peripheral.Instance.getHeroFirearm(RuneType.Vexing); //only used for bees right now if (start_from == Vector3.zero) { Firearm f = Peripheral.Instance.getHero(rune_type); if (f == null) { Peripheral.Instance.my_skillmaster.CancelSkill(skill_effect_type); Noisemaker.Instance.Click(ClickType.Error); Debug.Log("Cannot use Sentient Cloud skill " + skill_effect_type + " " + rune_type + ", no appropriate hero found\n"); return; } start_from = f.transform.position; } am_active = true; StatBit[] sb = new StatBit[1]; how_many = Mathf.FloorToInt(_stats[0]); sb[0] = new StatBit(); sb[0].effect_type = lava_effect_type; sb[0].updateStat(_stats[1]); sb[0].dumb = true; sb[0].very_dumb = true; //range = -s.stat * 2; range = _stats[2]; lava_life = _stats[3]; //bullets = 0, damage = 1, range = 2, lava kife = 3 stats = new StatSum(1, 0, sb, rune_type); Tracker.Log(PlayerEvent.SpecialSkillUsed, true, customAttributes: new Dictionary <string, string>() { { "attribute_1", EffectType.Bees.ToString() } }, customMetrics: new Dictionary <string, double>() { { "metric_1", level } }); }
//SWARM public void Init(StatBit bit, Transform target, Firearm firearm, EffectType type) { Prepare(bit, firearm, type); my_lava.Init(type, bit.level, lava_stats, lava_timer, true, firearm); my_lava.my_firearm = firearm; my_lava.SetLocation(target.transform, target.transform.position, lava_size, Quaternion.identity); my_lava.SetFactor(1); Vector3 pos = my_lava.transform.position; pos.z = 3.75f; my_lava.transform.position = pos; my_lava.gameObject.SetActive(true); }
public void MakeDiffuse(Vector3 pos) { // Debug.Log("Diffuse doing diffusion\n"); //force StatBit diffuse_statbit = stats.GetStatBit(EffectType.Diffuse); //StatSum lava_statsum_old = stats.cloneAndRemoveStat(EffectType.Diffuse); float[] stat_floats = diffuse_statbit.getStats(); StatSum lava_statsum = new StatSum(); lava_statsum.runetype = RuneType.Sensible; lava_statsum.stats = new StatBit[1]; StatBit lava_statbit = new StatBit(); lava_statbit.effect_type = EffectType.Force; lava_statbit.base_stat = stat_floats[5]; lava_statbit.rune_type = RuneType.Sensible; lava_statbit.dumb = true; lava_statbit.very_dumb = true; lava_statsum.stats[0] = lava_statbit; float range = stat_floats[0]; float lifespan = stat_floats[1]; float factor = stat_floats[2]; //this statbit is not dumb. Diffuse just diffuses whatever Vexing force the arrow has. //get your own lava since lavas live for much longer than arrows, arrows get reused much faster. //each arrow does not have its own lava lava = Zoo.Instance.getObject("Wishes/diffuse_lava", false).GetComponent <Lava>(); lava.SetLocation(null, pos, range, Quaternion.identity); lava.gameObject.SetActive(true); // Debug.Log("Diffuse lava lifetime " + lifespan + "\n"); lava.Init(EffectType.Diffuse, diffuse_statbit.level, lava_statsum, lifespan, true, arrow.myFirearm); lava.SetFactor(factor); arrow.MakeMeDie(false); }
public float getPrimary() { switch (runetype) { case RuneType.Sensible: return(GetStatBit(EffectType.Force).getStats()[0]); case RuneType.Airy: return(GetStatBit(EffectType.Speed).getStats()[0]); case RuneType.Vexing: float damage = GetStatBit(EffectType.VexingForce).getStats()[0]; StatBit extra = GetStatBit(EffectType.Focus); if (extra != null && extra.Level > 0) { damage += extra.getStats()[1]; } return(damage); } return(0f); }