Example #1
0
 /// <summary>
 /// Applies the effect.
 /// </summary>
 /// <param name="unit">Unit.</param>
 public virtual void ApplyEffect(Unit unit)
 {
     // If this is a temporary effect, add it to the unit
     if (_turns > 0)
     {
         unit.AddEffect(this);
     }
 }
Example #2
0
    public override void OnTick(Targetable target)
    {
        IEnumerable <Targetable> targetables = TargetingFunction.DetectSurroundings(_caster, IsValidTarget);

        foreach (Targetable t in targetables)
        {
            if (IsValidTarget(target))
            {
                _caster.AddEffect(_effect);
            }
        }
    }
 public static Skill getMakeMedStation()
 {
     if (makeMedStation == null)
     {
         makeMedStation                    = new Skill();
         makeMedStation.name               = "Med\nStation";
         makeMedStation.icon               = Resources.Load <Sprite>("SpellVisuals/MEDIC/MED STATION/med station");
         makeMedStation.description        = "Creates a med station that heals you and your buds. Great for parties";
         makeMedStation.manaCost           = user => 3;
         makeMedStation.targetType         = Skill.TargetType.NONE;
         makeMedStation.tileRestriction    = Skill.TargetTileRestriction.EMPTY;
         makeMedStation.cooldown           = 5;
         makeMedStation.range              = 2;
         makeMedStation.OnTilePostEffects += (user, tile, args) =>
         {
             GameObject go = (GameObject)GameObject.Instantiate((GameObject)Resources.Load("MedStationModel"), tile.transform.position, user.transform.rotation);
             Unit       u  = go.AddComponent <Unit>();
             u.icon      = Resources.Load <Sprite>("CharacterIcons/MedStationIcon");
             u.dontPlace = true;
             tile.SetUnit(u);
             u.faction       = user.faction;
             u.aiControlled  = true;
             u.baseMoveRange = 0;
             u.maxMP         = 10;
             u.maxHP         = 10;
             u.AddEffect(EffectFactory.getMedStationEffect(), -1);
             u.AddEffect(EffectFactory.getDoomEffect(), 5);
         };
         makeMedStation.GenerateTasks = (user, tile, args) =>
         {
             GameManager.instance.tasks.Add(new Task_Trigger_Animation(user, "Punch"));
             GameManager.instance.tasks.Add(new Task_Wait(0.3f));
             GameManager.instance.tasks.Add(new Task_PlaySound(Resources.Load <AudioClip>("SE/Heal2")));
             //GameManager.instance.tasks.Add(new Task_Fire_Projectile(user.transform.position + Vector3.up, tile.transform.position + Vector3.up, (GameObject)Resources.Load("SpellVisuals/MEDIC/MED STATION/med station projectile prefab")));
             makeMedStation.EnqueueExecuteTask(user, tile, args);
         };
     }
     return(makeMedStation);
 }
Example #4
0
 public virtual void Initialize(Unit _owner, int _duration)
 {
     owner    = _owner;
     duration = _duration;
     for (int i = 0; i < owner.Effects.Count; ++i)
     {
         if (owner.Effects[i].GetType() == this.GetType())
         {
             Debug.Log(owner.Effects[i].name + "  " + name);
             ((Effect)owner.Effects[i]).EndEffect();
         }
     }
     owner.AddEffect(this);
     OnEffectApplied();
 }
Example #5
0
    private void OnTriggerStay(Collider other)
    {
        //Debug.Log(other.name + " stays in " + name);

        if (other.gameObject.layer != GameLayer.Units)
        {
            return;
        }
        Unit target = other.GetComponent <Unit>();

        if (target == null)
        {
            return;
        }
        if (target.isFlying)
        {
            return;
        }

        target.AddEffect(effect);
    }
 public static Skill getMakeBattlePet()
 {
     if (makeBattlePet == null)
     {
         makeBattlePet                    = new Skill();
         makeBattlePet.name               = "Battle\nBot";
         makeBattlePet.icon               = Resources.Load <Sprite>("SpellVisuals/TECH/ROBOT PET/robot pet");
         makeBattlePet.description        = "A robot pet that seeks your love by acting as a tank for your party. Lasts 5 turns";
         makeBattlePet.manaCost           = user => 3;
         makeBattlePet.targetType         = Skill.TargetType.NONE;
         makeBattlePet.tileRestriction    = Skill.TargetTileRestriction.EMPTY;
         makeBattlePet.cooldown           = 5;
         makeBattlePet.range              = 2;
         makeBattlePet.OnTilePostEffects += (user, tile, args) =>
         {
             GameObject go = (GameObject)GameObject.Instantiate((GameObject)Resources.Load("basemodel"), tile.transform.position, user.transform.rotation);
             Unit       u  = go.AddComponent <Unit>();
             u.dontPlace = true;
             tile.SetUnit(u);
             u.faction       = user.faction;
             u.aiControlled  = true;
             u.baseMoveRange = 2;
             u.maxMP         = 10;
             u.maxHP         = 10;
             u.baseArmor     = 0.2f;
             u.AddSkill(SkillFactory.GetShiv());
             u.AddSkill(SkillFactory.GetSnipe());
             u.AddEffect(EffectFactory.getDoomEffect(), 5);
         };
         makeBattlePet.GenerateTasks = (user, tile, args) =>
         {
             GameManager.instance.tasks.Add(new Task_Trigger_Animation(user, "Punch"));
             GameManager.instance.tasks.Add(new Task_Wait(0.3f));
             GameManager.instance.tasks.Add(new Task_PlaySound(Resources.Load <AudioClip>("SE/Flash3")));
             GameManager.instance.tasks.Add(new Task_Fire_Projectile(user.transform.position + Vector3.up, tile.transform.position + Vector3.up, (GameObject)Resources.Load("SpellVisuals/TECH/ROBOT PET/battlebot projectile prefab"), 3));
             makeBattlePet.EnqueueExecuteTask(user, tile, args);
         };
     }
     return(makeBattlePet);
 }
 public static Skill GetMakeSentry()
 {
     if (makeSentry == null)
     {
         makeSentry                    = new Skill();
         makeSentry.name               = "Sentry";
         makeSentry.icon               = Resources.Load <Sprite>("SpellVisuals/TECH/SENTRY/sentry");
         makeSentry.description        = "Creates a sentry that dishes out Snipe attacks with no remores. Lasts 5 turns";
         makeSentry.manaCost           = user => 3;
         makeSentry.targetType         = Skill.TargetType.NONE;
         makeSentry.tileRestriction    = Skill.TargetTileRestriction.EMPTY;
         makeSentry.cooldown           = 5;
         makeSentry.range              = 2;
         makeSentry.OnTilePostEffects += (user, tile, args) =>
         {
             GameObject go = (GameObject)GameObject.Instantiate((GameObject)Resources.Load("SentryModel"), tile.transform.position, user.transform.rotation);
             Unit       u  = go.AddComponent <Unit>();
             u.icon      = Resources.Load <Sprite>("CharacterIcons/SentryIcon");
             u.dontPlace = true;
             tile.SetUnit(u);
             u.faction       = user.faction;
             u.aiControlled  = true;
             u.baseMoveRange = 0;
             u.maxMP         = 10;
             u.maxHP         = 10;
             u.AddSkill(SkillFactory.GetSnipe());
             u.AddEffect(EffectFactory.getDoomEffect(), 5);
         };
         makeSentry.GenerateTasks = (user, tile, args) =>
         {
             GameManager.instance.tasks.Add(new Task_Trigger_Animation(user, "Punch"));
             GameManager.instance.tasks.Add(new Task_Wait(0.3f));
             GameManager.instance.tasks.Add(new Task_Fire_Projectile(user.transform.position + Vector3.up, tile.transform.position + Vector3.up, (GameObject)Resources.Load("SpellVisuals/TECH/SENTRY/sentry projectile prefab"), 4));
             GameManager.instance.tasks.Add(new Task_PlaySound(Resources.Load <AudioClip>("SE/Magic4")));
             makeSentry.EnqueueExecuteTask(user, tile, args);
         };
     }
     return(makeSentry);
 }
Example #8
0
    //Handling collisions
    private void OnCollisionEnter(Collision collision)
    {
        //See if the collider hit was another unit, and if it was on an enemy team
        if (collision.gameObject.GetComponent <Unit>() != null)
        {
            Unit unitHit = collision.gameObject.GetComponent <Unit>();
            if (unitHit.teamIndex != teamIndex && combatState == UnitState.attacking)
            {
                //Combat Code
                CalculateCombatOutcome(unitHit);
            }

            else if (unitHit.teamIndex == teamIndex && combatState == UnitState.attacking && !hasBoosted)
            {
                //Allie Boost Code
                UIController.uiController.PopupAlertUI(UIController.boostedMessage, unitHit.transform.position);
                unitHit.nextAttackAllieBoosted += launchPower + currentAttackAllieBoosted;
                unitHit.AddEffect("Boost");
                currentAttackAllieBoosted = 0f;
                hasBoosted = true;
            }
        }
    }
Example #9
0
 public override void OnCharacterEnter(Unit unit)
 {
     unit.AddEffect(flightEffect);
     OnRemove();
 }
Example #10
0
    public TankFactory()
    {
        baseModel = Resources.Load <GameObject>("TankModel");

        attackPower = 0.9f;
        armor       = 0.4f;
        maxHP       = 7 * 2;
        maxMP       = 6;


        baseSkills.Add(SkillFactory.GetSlam());
        baseSkills.Add(SkillFactory.GetWeakenDefense());
        baseSkills.Add(SkillFactory.GetTaunt());

        Talent t = new Talent();

        t.name        = "Enrage";
        t.description = "While health is below 50%, damage goes up by 20%";
        t.IfChosen    = unit => {
            unit.AddEffect(EffectFactory.getEnrageEffect(), -1);
        };
        talentOptions.Add(t);

        t             = new Talent();
        t.name        = "Surrounded";
        t.description = "Whenever the tank is hit, if there are more than two enemies nearby, their attacks will recoil half the damage to eachother. This damage is never fatal.";
        t.IfChosen    = unit =>
        {
            unit.AddEffect(EffectFactory.getSurroundedEffect(), -1);
        };
        talentOptions.Add(t);

        t             = new Talent();
        t.name        = "Grand Slam";
        t.description = "Double's Slam's Damage, but halfs the root effect";
        t.IfChosen    = unit =>
        {
            unit.talentTags.Add("HardSlam");
        };
        talentOptions.Add(t);

        t             = new Talent();
        t.name        = "Determination";
        t.description = "If the tank's health would go below 30% from an attack, the tank is first fully healed. Has a 6 turn cooldown";
        t.IfChosen    = unit =>
        {
            unit.AddEffect(EffectFactory.getDeterminationEffect(), -1); //-1 is permanent
        };
        talentOptions.Add(t);

        t             = new Talent();
        t.name        = "Front Lines";
        t.description = "For each enemy within 3 tiles, gain 3% hp per turn";
        t.IfChosen    = unit =>
        {
            unit.AddEffect(EffectFactory.getFrontLineEffect(), -1);
        };
        talentOptions.Add(t);

        t             = new Talent();
        t.name        = "Toughness";
        t.description = "The Tank is just tough. Nothing complicated. Slight increase to armor and damage.";
        t.IfChosen    = Unit =>
        {
            Unit.AddEffect(EffectFactory.getToughEffect(), -1);
        };
        talentOptions.Add(t);

        name        = "Tank";
        description = "A tank. Deals and takes little damage. Hinders enemies to protect his team.";
        image       = Resources.Load <Sprite>("CharacterIcons/TankIcon");
    }
Example #11
0
    public TechFactory()
    {
        baseModel = Resources.Load <GameObject>("TechModel");

        attackPower = 0.9f;
        armor       = 0.4f;
        maxHP       = 10;
        maxMP       = 6;


        baseSkills.Add(SkillFactory.GetSnipe());
        baseSkills.Add(SkillFactory.GetRepair());
        baseSkills.Add(SkillFactory.GetMakeSentry());

        Talent t = new Talent();

        t.name        = "Med Station";
        t.description = "Able to create med stations. Static structures that restore health to nearby allies every turn.";
        t.IfChosen    = unit => {
            unit.AddSkill(SkillFactory.getMakeMedStation());
        };
        talentOptions.Add(t);

        t             = new Talent();
        t.name        = "Add Repair";
        t.description = "Adds Repair to Class";
        t.IfChosen    = unit =>
        {
            unit.AddSkill(SkillFactory.GetRepair());
        };
        talentOptions.Add(t);

        t             = new Talent();
        t.name        = "Battle Bot";
        t.description = "Creates a mobile robot buddy. Will move to and attack enemies for you.";
        t.IfChosen    = unit =>
        {
            unit.AddSkill(SkillFactory.getMakeBattlePet());
        };
        talentOptions.Add(t);

        t             = new Talent();
        t.name        = "Sticky Grenade";
        t.description = "Attaches a sticky grenade to an enemy, which explodes after 2 turns.";
        t.IfChosen    = unit =>
        {
            unit.AddSkill(SkillFactory.getStickyGrenade());
        };
        talentOptions.Add(t);

        t             = new Talent();
        t.name        = "Master Sniper";
        t.description = "Snipe is free.";
        t.IfChosen    = unit =>
        {
            unit.talentTags.Add("FreeSnipe");
        };
        talentOptions.Add(t);

        t             = new Talent();
        t.name        = "Toughness";
        t.description = "The Tech is just tough. Nothing complicated. Slight increase to armor and damage.";
        t.IfChosen    = Unit =>
        {
            Unit.AddEffect(EffectFactory.getToughEffect(), -1);
        };
        talentOptions.Add(t);

        name        = "Technician";
        description = "A repairman who can build robots";
        image       = Resources.Load <Sprite>("CharacterIcons/TechIcon");
    }
Example #12
0
 private void UnitUpdate() //запуск кулдауна у скиллов, добавление эффекта, активация эффекта
 {
     CoolDownStart();
     targetUnit.AddEffect(skill); //добавляем эффект скила в список
     // units[0].GetComponent<Unit>().ActivateEffect(); //активация эффекта
 }
 public override void OnApplication(Unit unit)
 {
     unit.AddEffect(this, (GameObject) Resources.Load("Effects/force_field"));
 }