Esempio n. 1
0
    static public string getReward(RewardType c)
    {
        switch (c)
        {
        case RewardType.Modulator:
            return("Imagination wishes horses something something. Gain the modulator. Use it to change island color.");

        case RewardType.Determined:
            return("Have some extra (whatever). You earned it.");

        case RewardType.HeroMobility:
            return("Heroes can now be relocated to any other island on the map.");

        case RewardType.LaserFinisher:
            return("Level " + StaticStat.getFinisherLvl() + " Laser finisher enabled.");

        case RewardType.RapidFireFinisher:
            return("Level " + StaticStat.getFinisherLvl() + " RapidFire finisher enabled.");

        case RewardType.FearFinisher:
            return("Level " + StaticStat.getFinisherLvl() + " Fear afflicted enemies spread fear to surrounding enemies.");

        case RewardType.SparklesFinisher:
            return("Level " + StaticStat.getFinisherLvl() + " Sparkles produce more sparkles when they hit their targets.");

        case RewardType.CriticalFinisher:
            return("Level " + StaticStat.getFinisherLvl() + " Critical attacks have a chance of killing their targets.");

        case RewardType.TransformFinisher:
            return("Level " + StaticStat.getFinisherLvl() + " Transform may turn the enemy into a giant whale.");

        default:
            return("Uknown reward " + c.ToString() + " it's probably something awesome though who knows.");
        }
    }
Esempio n. 2
0
    public float _getSignalSize(unitStats s)
    {
        float size = 0.5f;


        float distance_bonus = 0f;

        if (s.toy_id.toy_type == ToyType.Temporary)
        {
            distance_bonus = StaticRune.GetDistanceBonus(s.name, islands[island_selected].transform.position, null);
        }
        if (s.toy_id.rune_type == RuneType.SensibleCity)
        {
            return(0.5f);
        }
        if (s != null)
        {
            size = StaticRune.time_bonus_aff(StaticStat.getBaseFactor(s.toy_id.rune_type, EffectType.Range, s.toy_id.toy_type == ToyType.Hero),
                                             EffectType.Range, s.toy_id.rune_type, s.toy_id.toy_type, distance_bonus) / 2f;
        }

        //   Debug.Log("Getting signal size for " + selected + " got " + size + "\n");

        return(size);
    }
Esempio n. 3
0
    public void Init(float[] stats, float mass)
    {
        min_multiplier = stats[0];
        max_multiplier = stats[1];
        percent_hit    = stats[2];
        base_mass      = mass;

        finisher_percent = (stats.Length == StaticStat.StatLength(EffectType.Critical, true)) ? stats[3] : 0;
    }
Esempio n. 4
0
    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();
        }
    }
Esempio n. 5
0
    //DOT
    //regenerator doing damage => has negative stats[0]
    public float Init(HitMe _hitme, float[]  stats, RegeneratorType _type, Firearm firearm, int level)
    {
        repeat_rate   = Get.regenerator_repeat_rate;
        heal_duration = -1;
        type          = _type;
        my_hitme      = _hitme;
        effect_type   = EffectType.DOT;
        //if (_towerID != 0 && towerID != _towerID)
        //{
        //  towerID = _towerID;
        //my_firearm = getFirearm(towerID);
        // }
        my_firearm = firearm;
        monsters   = null;

        this.level = level;
        duration   = stats[1];
        EnableVisuals(_hitme, duration);
        TIME = 0f;
        if (is_active)
        {
            if (my_lava != null)
            {
                my_lava.lifespan = duration;
            }
            return(0f);
        }

        float finisher_percent = (stats.Length == StaticStat.StatLength(EffectType.DOT, true)) ? stats[3] : 0;

        if (finisher_percent > 0 && UnityEngine.Random.RandomRange(0, 1) < finisher_percent)
        {
            //  SetEverythingOnFire(stats);
            //    Debug.Log("Fin\n");
        }

        total_time     = duration + .1f; // this isn only intended for 1 time use, not repeating
        period         = -1;
        rate           = Get.getRegeneratorModRate(repeat_rate, stats[0], duration);
        type           = _type;
        done_for_good  = false;
        is_active      = true;
        am_doing_stuff = false;
        first_invoke   = true;
        //    Debug.Log("initializing regenerator total time " + total_time + " duration " + duration + " rate " + rate
        //                   + " repeat_rate " + repeat_rate + " stat " + stats[0] + "\n");
        return(0);
    }
Esempio n. 6
0
    //weaken applies to defenses that are both in hitme.defenses and in hitme.init_defenses, won't apply to secondary defenses that may be added later on, like Fear.
    public float Init(HitMe _hitme, float[] stats)  //, float aff, float _lifetime){
    {
        my_hitme  = _hitme;
        my_time   = 0;
        is_active = true;

        float by = Get.getPercent(stats[0]);

        lifetime = stats[1];

        _hitme.EnableVisuals(MonsterType.Weaken, lifetime);

        original_defenses = new List <Defense>();
        //   Debug.Log("WEAKEN by " + by + " for " + lifetime + "\n");

        finisher_percent = (stats.Length == StaticStat.StatLength(EffectType.Weaken, true)) ? stats[1] : 0;
        if (finisher_percent > 0 && UnityEngine.Random.RandomRange(0, 1) < finisher_percent)
        {
            by = 0.05f;
        }

        foreach (Defense def in my_hitme.defenses)
        {
            Defense init = null;
            foreach (Defense init_def in my_hitme.init_defenses)
            {
                if (def.type == init_def.type)
                {
                    original_defenses.Add(new Defense(init_def.type, init_def.strength));
                    init = init_def;
                }
            }

            if (init != null)
            {
                def.strength = init.strength * by;
            }
        }
        return(by / 40f);
    }
Esempio n. 7
0
    public float Init(HitMe _hitme, float[] stats)
    {
        float _lifetime   = stats[0];
        float little_more = 0.1f;//otherwise it looks like it ends too soon because some of them take time to turn around

        if (is_active)
        {
            lifetime = _lifetime;
            my_time  = 0f;
            _hitme.EnableVisuals(MonsterType.Fear, lifetime + little_more);
            if (my_lava != null)
            {
                my_lava.lifespan = lifetime;
            }
            return(0.15f);
        }

        my_ai  = _hitme.my_ai;
        finish = my_ai.player.transform;
        start  = WaypointMultiPathfinder.Instance.paths[my_ai.path].start.transform;

        my_time   = 0;
        is_active = true;

        lifetime     = _lifetime;
        my_ai.player = start;
        my_ai.getNewPath();
        my_ai.forward_only = false;
        _hitme.EnableVisuals(MonsterType.Fear, lifetime + lifetime);

        float finisher_percent = (stats.Length == StaticStat.StatLength(EffectType.Fear, true)) ? stats[3] : 0;

        if (finisher_percent > 0 && UnityEngine.Random.RandomRange(0, 1) < finisher_percent)
        {
            CauseMassPanic(stats);
            //    Debug.Log("Fin\n");
        }

        return(0.15f);
    }
Esempio n. 8
0
    public void LoadToyStats()
    {
        if (actor_stats.Count == 0)
        {
            Central.Instance.LockAllToys();
            foreach (unitStats a in Central.Instance.actors)
            {
                a.isUnlocked = StaticStat.isUnlocked(a.toy_id.rune_type, a.toy_id.toy_type == ToyType.Hero, a.isUnlocked);
            }
            return; //new game
        }

        Central.Instance.LockAllToys();
        foreach (unitStatsSaver a in actor_stats)
        {
            Central.Instance.getToy(a.name).loadSnapshot(a);
        }
        foreach (unitStats a in Central.Instance.actors)
        {
            a.isUnlocked = StaticStat.isUnlocked(a.toy_id.rune_type, a.toy_id.toy_type == ToyType.Hero, a.isUnlocked);
        }
    }
Esempio n. 9
0
    public float Upgrade(EffectType type, bool use_resource, bool force, bool reset)
    {//ghosts should be verifying with parent to see if they can upgrade
        if (!reset && !force && toy_type != ToyType.Temporary && !(CanUpgrade(type, runetype, true) == StateType.Yes))
        {
            Debug.Log("You shouldn't be trying to upgrade this!"); return(0);
        }
        int i = getStatID(type);

        // FALSE USE_RESOURCE IS ONLY FOR TESTING or parent tower to ghost tower upgrades

        //    Debug.Log("Upgrading (reset = " + reset + ")" + type + "\n");

        if (i != -1)
        {
            //if (reset && stats[i].level == 0) return 0;
            //	Debug.Log("Leveling up " + type + "\n");


            int  old_level = stats[i].Level;
            Cost init_cost = stats[i].cost;
            if (reset)
            {
                if (!Get.isGeneric(type))
                {
                    stats[i].active = false;
                }
                if (!Get.isSpecial(type))
                {
                    level -= stats[i].Level;
                }
                stats[i].Level = 0;
            }
            else
            {
                stats[i].active = true;
                stats[i].LevelUp(); //cost update happens here
            }

            if (!Get.isSpecial(type))
            {
                if (!reset)
                {
                    level++;
                }
                invested_cost += stats[i].cost.Amount;
            }

            if (use_resource)
            {
                if (reset)
                {
                    Cost cost = StaticStat.getCumulativeCost(runetype, stats[i].effect_type, old_level);
                    if (cost != null)
                    {
                        int amount = (int)cost.Amount;
                        if (stats[i].cost.type == CostType.ScorePoint)
                        {
                            ScoreKeeper.Instance.SetTotalScore(ScoreKeeper.Instance.getTotalScore() + amount);
                        }
                        else if (stats[i].cost.type == CostType.Dreams)
                        {
                            Peripheral.Instance.addDreams(amount, Vector3.zero, false);
                        }
                    }
                }
                else
                {
                    Peripheral.Instance.UseResource(init_cost, Vector3.zero);
                }
            }

            UpdateStats();

            if (Central.Instance.state == GameState.InGame && (type == EffectType.Range || type == EffectType.Focus || type == EffectType.RapidFire))
            {
                Monitor.Instance.SetSignalSize(getRange() / 2f); // to upgrade the currently displayed range signal
            }
            else if (Get.isSpecial(type))
            {
                DoSpecialThing(type);
            }

            //onUpgrade is necessary for Firearm to update itself after upgrades
            if (ID != -1)
            {
                if (onUpgrade != null)
                {
                    onUpgrade(type, ID);
                }
            }


            if (use_resource && !force && !reset)
            {
                Tracker.Log(PlayerEvent.SkillUpgrade, !Get.isSpecial(type),
                            customAttributes: new Dictionary <string, string>()
                {
                    { "attribute_2", Peripheral.Instance.difficulty.ToString() }, { "attribute_1", type.ToString() }
                },
                            customMetrics: new Dictionary <string, double>()
                {
                    { "metric_1", stats[i].level }, { "metric_2", order }
                });
            }


            return(stats[i].cost.Amount);
        }
        else
        {
            Debug.Log("Trying to level up unknown stat " + type + " for " + runetype + ", not sure what to do\n");
            return(0);
        }
    }
Esempio n. 10
0
    public Cost GetUpgradeCost(EffectType type)
    {
        int s = getStatID(type);

        return((s != -1) ? StaticStat.getCost(runetype, type, stats[s].Level) : null);
    }
Esempio n. 11
0
    public static void assignStatBits(ref StatBit[] stats, Rune rune)
    {
        StatReq[] rt        = new StatReq[1];
        bool      is_hero   = (rune.toy_type == ToyType.Hero);
        bool      is_active = true;
        RuneType  rune_type = rune.runetype;
        int       i         = 0;

        switch (rune_type)
        {
        case RuneType.Sensible:
            if (is_hero)
            {
                stats = new StatBit[9];
            }
            else
            {
                stats = new StatBit[7];
            }

            rt[0]      = new StatReq(EffectType.ReloadTime, 0);
            stats[i++] = new StatBit(rune, RuneType.Sensible, EffectType.ReloadTime, is_active, rt, 0, 0, is_hero);

            StatReq[] r = new StatReq[1];
            r[0]       = new StatReq(EffectType.Range, 0);
            stats[i++] = new StatBit(rune, RuneType.Sensible, EffectType.Range, is_active, r, 0, 0, is_hero);

            StatReq[] f = new StatReq[1];
            f[0]       = new StatReq(EffectType.Force, 0);
            stats[i++] = new StatBit(rune, RuneType.Sensible, EffectType.Force, is_active, f, 0, 0, is_hero);

            is_active = false;
            // LASER    +      DIFFUSE


            /// LASER BRANCH
            StatReq[] l = new StatReq[1];
            l[0]       = new StatReq(EffectType.Diffuse, -1);
            stats[i++] = new StatBit(rune, RuneType.Sensible, EffectType.Laser, is_active, l, 0, 0, is_hero);

            StatReq[] l2 = new StatReq[1];
            l2[0]      = new StatReq(EffectType.Laser, 1);
            stats[i++] = new StatBit(rune, RuneType.Sensible, EffectType.Sparkles, is_active, l2, 0, 0, is_hero);


            //vexing Diffuse
            StatReq[] no_laser = new StatReq[1];
            no_laser[0] = new StatReq(EffectType.Laser, -1);
            stats[i++]  = new StatBit(rune, RuneType.Sensible, EffectType.Diffuse, is_active, no_laser, 0, 0, is_hero);

            StatReq[] have_diffuse = new StatReq[1];
            have_diffuse[0] = new StatReq(EffectType.Diffuse, 1);
            stats[i++]      = new StatBit(rune, RuneType.Sensible, EffectType.Transform, is_active, have_diffuse, 0, 0, is_hero);

            /// HERO STUFF
            if (is_hero)
            {
                StatReq[] aa = new StatReq[1];
                aa[0]      = new StatReq(EffectType.Force, 0);
                stats[i++] = new StatBit(rune, RuneType.Sensible, EffectType.AirAttack, is_active, aa, StaticStat.getInitRechargeTime(EffectType.AirAttack), 0, is_hero);

                stats[i++] = new StatBit(rune, RuneType.Sensible, EffectType.Meteor, is_active, aa, StaticStat.getInitRechargeTime(EffectType.Meteor), 0, is_hero);
            }
            rune.stats = stats;
            return;

        case RuneType.Airy:

            if (is_hero)
            {
                stats = new StatBit[11];
            }
            else
            {
                stats = new StatBit[8];
            }

            StatReq[] art = new StatReq[1];
            art[0]   = new StatReq(EffectType.ReloadTime, 0);
            stats[0] = new StatBit(rune, RuneType.Airy, EffectType.ReloadTime, is_active, art, 0, 0, is_hero);

            StatReq[] ar = new StatReq[1];
            ar[0]    = new StatReq(EffectType.Range, 0);
            stats[1] = new StatBit(rune, RuneType.Airy, EffectType.Range, is_active, ar, 0, 0, is_hero);

            StatReq[] def = new StatReq[1];
            def[0]   = new StatReq(EffectType.Speed, 0);
            stats[2] = new StatBit(rune, RuneType.Airy, EffectType.Speed, is_active, def, 0, 0, is_hero);

            StatReq[] af = new StatReq[1];
            af[0]    = new StatReq(EffectType.Force, 0);  //paired with speed, updateded when speed is upgraded
            stats[3] = new StatBit(rune, RuneType.Airy, EffectType.Force, is_active, af, 0, 0, is_hero);

            //UPGRADES
            is_active = false;

            StatReq[] m = new StatReq[1];
            m[0]     = new StatReq(EffectType.Weaken, -1);
            stats[4] = new StatBit(rune, RuneType.Airy, EffectType.Calamity, is_active, m, 0, 0, is_hero);

            StatReq[] sm = new StatReq[1];
            sm[0]    = new StatReq(EffectType.Calamity, 1);
            stats[5] = new StatBit(rune, RuneType.Airy, EffectType.Swarm, is_active, sm, 0, 0, is_hero);

            StatReq[] w = new StatReq[1];
            w[0]     = new StatReq(EffectType.Calamity, -1);
            stats[6] = new StatBit(rune, RuneType.Airy, EffectType.Weaken, is_active, w, 0, 0, is_hero);

            StatReq[] ww = new StatReq[1];
            ww[0]    = new StatReq(EffectType.Weaken, 1);
            stats[7] = new StatBit(rune, RuneType.Airy, EffectType.Foil, is_active, ww, 0, 0, is_hero);



            if (is_hero)
            {
                stats[8] = new StatBit(rune, RuneType.Airy, EffectType.Frost, is_active, def, StaticStat.getInitRechargeTime(EffectType.Frost), 0, is_hero);
                //same requirements anyway
                stats[9]  = new StatBit(rune, RuneType.Airy, EffectType.EMP, is_active, def, StaticStat.getInitRechargeTime(EffectType.EMP), 0, is_hero);
                stats[10] = new StatBit(rune, RuneType.Airy, EffectType.Plague, is_active, def, StaticStat.getInitRechargeTime(EffectType.Plague), 0, is_hero);
            }

            rune.stats = stats;
            return;

        case RuneType.Vexing:

            if (is_hero)
            {
                stats = new StatBit[10];
            }
            else
            {
                stats = new StatBit[8];
            }

            StatReq[] vrt = new StatReq[1];
            vrt[0]     = new StatReq(EffectType.ReloadTime, 0);
            stats[i++] = new StatBit(rune, RuneType.Vexing, EffectType.ReloadTime, is_active, vrt, 0, 0, is_hero);

            StatReq[] vr = new StatReq[1];
            vr[0]      = new StatReq(EffectType.Range, 0);
            stats[i++] = new StatBit(rune, RuneType.Vexing, EffectType.Range, is_active, vr, 0, 0, is_hero);

            StatReq[] fr = new StatReq[1];
            fr[0]      = new StatReq(EffectType.VexingForce, 0);
            stats[i++] = new StatBit(rune, RuneType.Vexing, EffectType.VexingForce, is_active, fr, 0, 0, is_hero);

            //UPGRADES
            is_active = false;

            // RAPID FIRE    +   FOCUS

            // FOCUS
            StatReq[] no_rapidfire = new StatReq[1];
            no_rapidfire[0] = new StatReq(EffectType.RapidFire, -1);
            stats[i++]      = new StatBit(rune, RuneType.Vexing, EffectType.Focus, is_active, no_rapidfire, 0, 0, is_hero);

            StatReq[] have_focus = new StatReq[1];
            have_focus[0] = new StatReq(EffectType.Focus, 1);
            stats[i++]    = new StatBit(rune, RuneType.Vexing, EffectType.Fear, is_active, have_focus, 0, 0, is_hero);
            stats[i++]    = new StatBit(rune, RuneType.Vexing, EffectType.Critical, is_active, have_focus, 0, 0, is_hero);



            // RAPID FIRE
            StatReq[] rapid_fire = new StatReq[1];
            rapid_fire[0] = new StatReq(EffectType.Focus, -1);
            stats[i++]    = new StatBit(rune, RuneType.Vexing, EffectType.RapidFire, is_active, rapid_fire, 0, 0, is_hero);

            StatReq[] DOT = new StatReq[1];
            DOT[0]     = new StatReq(EffectType.RapidFire, 1);
            stats[i++] = new StatBit(rune, RuneType.Vexing, EffectType.DOT, is_active, DOT, 0, 0, is_hero);


            //vexing Focus


            if (rune.toy_type == ToyType.Hero)
            {
                StatReq[] t = new StatReq[1];
                t[0]       = new StatReq(EffectType.Teleport, 0);
                stats[i++] = new StatBit(rune, RuneType.Vexing, EffectType.Teleport, is_active, t, StaticStat.getInitRechargeTime(EffectType.Teleport), 0, is_hero);

                StatReq[] b = new StatReq[1];
                b[0]       = new StatReq(EffectType.Bees, 0);
                stats[i++] = new StatBit(rune, RuneType.Vexing, EffectType.Bees, is_active, b, StaticStat.getInitRechargeTime(EffectType.Bees), 0, is_hero);
            }

            rune.stats = stats;
            return;

        case RuneType.Slow:
            stats = new StatBit[3];

            StatReq[] slrt = new StatReq[1];
            slrt[0]  = new StatReq(EffectType.ReloadTime, 0);
            stats[0] = new StatBit(rune, RuneType.Slow, EffectType.ReloadTime, is_active, slrt, 0, 0, is_hero);

            StatReq[] slr = new StatReq[1];
            slr[0]   = new StatReq(EffectType.Range, 0);
            stats[1] = new StatBit(rune, RuneType.Slow, EffectType.Range, is_active, slr, 0, 0, is_hero);

            StatReq[] slf = new StatReq[1];
            slf[0]     = new StatReq(EffectType.Force, 0);
            stats[2]   = new StatBit(rune, RuneType.Slow, EffectType.Force, is_active, slf, 0, 0, is_hero);
            rune.stats = stats;
            return;

        case RuneType.Fast:
            stats = new StatBit[3];

            StatReq[] frt = new StatReq[1];
            frt[0]   = new StatReq(EffectType.ReloadTime, 0);
            stats[0] = new StatBit(rune, RuneType.Fast, EffectType.ReloadTime, is_active, frt, 0, 0, is_hero);

            StatReq[] far = new StatReq[1];
            far[0]   = new StatReq(EffectType.Range, 0);
            stats[1] = new StatBit(rune, RuneType.Fast, EffectType.Range, is_active, far, 0, 0, is_hero);


            StatReq[] f2 = new StatReq[1];
            f2[0]      = new StatReq(EffectType.Force, 0);
            stats[2]   = new StatBit(rune, RuneType.Fast, EffectType.Force, is_active, f2, 0, 0, is_hero);
            rune.stats = stats;
            return;

        case RuneType.Time:
            stats = new StatBit[3];

            StatReq[] rt2 = new StatReq[1];
            rt2[0]   = new StatReq(EffectType.ReloadTime, 0);
            stats[0] = new StatBit(rune, RuneType.Time, EffectType.ReloadTime, is_active, rt2, 0, 0, is_hero);

            StatReq[] r2 = new StatReq[1];
            r2[0]    = new StatReq(EffectType.Range, 0);
            stats[1] = new StatBit(rune, RuneType.Time, EffectType.Range, is_active, r2, 0, 0, is_hero);

            StatReq[] f3 = new StatReq[1];
            f3[0]    = new StatReq(EffectType.Speed, 0);
            stats[2] = new StatBit(rune, RuneType.Time, EffectType.Speed, is_active, f3, 0, 0, is_hero);
            stats[2].effect_sub_type = EffectSubType.Ultra;
            rune.stats = stats;
            return;

        case RuneType.Modulator:
            stats      = new StatBit[0];
            rune.stats = stats;
            return;

        case RuneType.Castle:
            //Castle = + health, + wish % , construction efficiency
            stats = new StatBit[2];

            is_active = false;
            StatReq[] ph = new StatReq[1];
            ph[0]    = new StatReq(EffectType.Renew, 0);
            stats[0] = new StatBit(rune, RuneType.Castle, EffectType.Renew, is_active, ph, 0, 0, is_hero);

            StatReq[] ce = new StatReq[1];
            ce[0]      = new StatReq(EffectType.Architect, 0);
            stats[1]   = new StatBit(rune, RuneType.Castle, EffectType.Architect, is_active, ce, 0, 0, is_hero);
            rune.stats = stats;
            return;

        case RuneType.SensibleCity:
            //Sensible city = summon sensible temporary towers, base ammo
            stats = new StatBit[3];

            StatReq[] tr = new StatReq[1];
            tr[0]    = new StatReq(EffectType.TowerRange, 0);
            stats[0] = new StatBit(rune, RuneType.SensibleCity, EffectType.TowerRange, is_active, tr, 0, 0, is_hero);

            StatReq[] tf = new StatReq[1];
            tf[0]    = new StatReq(EffectType.TowerForce, 0);
            stats[1] = new StatBit(rune, RuneType.SensibleCity, EffectType.TowerForce, is_active, tf, 0, 0, is_hero);

            StatReq[] scr = new StatReq[1];
            scr[0]     = new StatReq(EffectType.Range, 0);
            stats[2]   = new StatBit(rune, RuneType.SensibleCity, EffectType.Range, is_active, scr, 0, 0, is_hero);
            rune.stats = stats;
            return;

        default:
            return;
        }
    }
Esempio n. 12
0
    public float Init(HitMe _hitme, float[] stats)
    {
        percent_increase = Get.getPercent(stats[0]);
        lifetime         = stats[1];
        my_time          = 0;
        _hitme.EnableVisuals(MonsterType.Wishful, lifetime);

        if (is_active)
        {
            return(percent_increase);
        }

        my_hitme  = _hitme;
        is_active = true;


        // Debug.Log("initializing wish catcher: percent increase " + percent_increase + " for " + lifetime + "\n");
        original_wish_list = new List <Wish>();



        finisher_percent = (stats.Length == StaticStat.StatLength(EffectType.WishCatcher, true)) ? stats[2] : 0;

        bool finisher = (finisher_percent > 0 && UnityEngine.Random.RandomRange(0, 1) < finisher_percent);

        if (finisher)
        {
            lifetime = stats[1] * 2f;        //some other stuff as well like add health and other nice wishes
        }
        original_wish_list = CloneUtil.copyList(_hitme.stats.inventory);

        bool have_health = false;
        bool have_damage = false;
        bool have_dreams = false;

        Debug.Log("Wishcatcher " + stats[0] + " -> " + percent_increase + "\n");
        foreach (Wish w in _hitme.stats.inventory)
        {
            w.percent *= (1 + percent_increase);
            //  Debug.Log("Setting " + _hitme.gameObject.name + " " + w.type + " to " + w.strength + "\n");
            if (finisher)
            {
                w.percent *= (1 + finisher_percent);
                if (w.type == WishType.MoreHealth)
                {
                    have_health = true;
                }
                if (w.type == WishType.MoreDreams)
                {
                    have_dreams = true;
                }
                if (w.type == WishType.MoreDamage)
                {
                    have_damage = true;
                }
            }
        }

        if (finisher && !have_health)
        {
            _hitme.stats.inventory.Add(new Wish(WishType.MoreHealth, 1, finisher_percent));
        }
        if (finisher && !have_dreams)
        {
            _hitme.stats.inventory.Add(new Wish(WishType.MoreDreams, 0.25f, finisher_percent));
        }
        if (finisher && !have_damage)
        {
            _hitme.stats.inventory.Add(new Wish(WishType.MoreDamage, 0.25f, finisher_percent));
        }

        return(percent_increase);
    }