Exemplo n.º 1
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;
    }
Exemplo n.º 2
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();
        }
    }
Exemplo n.º 3
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);
    }
Exemplo n.º 4
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);
    }
Exemplo n.º 5
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);
    }
Exemplo n.º 6
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);
    }