Inheritance: MonoBehaviour
Example #1
0
 public override void Activate(Hero hero, Level lvl)
 {
     remainUsetime--;
     switch (Bonustype)
     {
         case Bonustype.defence:
             hero.Parameters[ParamType.MDef] *= power;
             hero.Parameters[ParamType.PDef] *= power;
             break;
         case Bonustype.maxHp:
             hero.Parameters[ParamType.Heath] *= power;
             break;
         case Bonustype.speed:
             hero.Parameters[ParamType.Speed] += power;
             break;
         case Bonustype.damage:
             hero.Parameters[ParamType.MPower] *= power;
             hero.Parameters[ParamType.PPower] *= power;
             break;
         case Bonustype.energy:
             lvl.Energy.SpeedEnergyFallCoef = 0.9f;
             break;
         case Bonustype.cryslats:
             lvl.CrystalsBonus = power;
             break;
         case Bonustype.money:
             lvl.MoneyBonusFromItem = power;
             break;
     }
     if (remainUsetime <= 0)
     {
         MainController.Instance.PlayerData.RemoveItem(this);
     }
 }
    //Called when a level is loaded
	void OnLevelWasLoaded() {
        restartTimer = 0;
        totalMinutes = 0;
        playTimer = 0;
        GameOver = false;
        if (Application.loadedLevel == 1)
        {
            theSun = GameObject.Find("spotlight").GetComponent<Light>();
            mHero = GameObject.Find("Hero").GetComponent<Hero>();
            mTimer = GameObject.Find("Timer").GetComponent<Slider>();
            mHBar = GameObject.Find("hpBar").GetComponent<Slider>();
            mMin = GameObject.Find("minCounter").GetComponent<Text>();
            mSec = GameObject.Find("secCounter").GetComponent<Text>();
            Info = GameObject.Find("Info").GetComponent<Text>();
            mPanel = GameObject.Find("Panel").GetComponent<Image>();
            mPanel.gameObject.SetActive(false);
            Info.gameObject.SetActive(false);
            if(gameType == ENDLESS || gameType == DEBUG)
            {
                mTimer.gameObject.SetActive(false);
            }
            SpawnVariableControl();
            StartCoroutine(MasterSpawner(Troll));
        }
        else
        {
            SetButtons();
        }
	}
Example #3
0
 private void PlayOpen(Hero hero)
 {
     isActive = false;
     ActivePart.gameObject.SetActive(isActive);
     switch (bonusElementMapType)
     {
         case BonusElementMapType.energy:
             MainController.Instance.level.AddItem(ItemId.energy, -25);
             break;
         case BonusElementMapType.heal:
             hero.GetHeal((hero.Parameters.MaxHp)/2f);
             break;
         case BonusElementMapType.shield:
             hero.Shield = hero.Parameters.MaxHp/3f;
             break;
         case BonusElementMapType.speed:
             var e = new ParameterEffect(hero,10,ParamType.Speed, 2f);
             TimeEffect.Creat(hero, e);
             break;
         case BonusElementMapType.killAll:
             var enemies = Map.Instance.GetEnimiesInRadius(36);
             foreach (var baseMonster in enemies)
             {
                 if (baseMonster is BossUnit)
                 {
                     continue;
                 }
                 Debug.Log(" " + baseMonster.mainHeroDist);
                 baseMonster.SetHp(-1);
             }
             break;
     }
 }
Example #4
0
        private static void Main(string[] args)
        {
            Player = ObjectMgr.LocalHero;

            // Listen to Events
            Game.OnUpdate += Game_OnUpdate;
        }
Example #5
0
        private static void Game_OnUpdate(EventArgs args)
        {
            if (Game.IsPaused || Game.IsWatchingGame || !Game.IsInGame)
                return;
            me = ObjectMgr.LocalHero;
            if (me == null)
                return;

            if (!me.IsAlive)
                return;
            Unit Things = ObjectMgr.GetEntities<Unit>()
                .FirstOrDefault(
                    x =>
                        (x.ClassID == ClassID.CDOTA_NPC_Observer_Ward ||
                         x.ClassID == ClassID.CDOTA_NPC_Observer_Ward_TrueSight || x.ClassID == ClassID.CDOTA_NPC_TechiesMines /*|| x.ClassID == ClassID.CDOTA_NPC_Treant_EyesInTheForest*/)
                        && x.Team != me.Team && me.NetworkPosition.Distance2D(x.NetworkPosition) < 450 &&
                        x.IsVisible && x.IsAlive);
            if (!me.IsChanneling() && Utils.SleepCheck("Use"))
            {
                if (Things != null)
                {
                    var useItem = items.Select(item => me.FindItem(item)).FirstOrDefault(x => x != null && x.CanBeCasted());
                    if (useItem != null && !((useItem.Name == "item_tango_single" || useItem.Name == "item_tango") && Things.ClassID == ClassID.CDOTA_NPC_TechiesMines))
                    {
                        useItem.UseAbility(Things);
                        Utils.Sleep(250, "Use");
                    }
                    Utils.Sleep(250, "Use");
                }
            }
        }
Example #6
0
    IEnumerator teleport(Hero hero, Collider2D collider)
    {
        // TODO: when hero lands on the target door, he is not perfect grounded with the door
        // fine-tune this!
        float heroHeight = collider.bounds.extents.y;
        float doorTargetHeight = doorTarget.GetComponent<BoxCollider2D>().bounds.extents.y;
        Vector2 heroVerticalPositionOffset = new Vector2(0, doorTargetHeight - heroHeight);

        Vector2 doorTargetPosition = doorTarget.transform.position;

        if ((bothHeroesNeeded && isHeroStrongAtDoor && isHeroFastAtDoor))
        {
            heroStrong.gameObject.SetActive(false);
            heroFast.gameObject.SetActive(false);
            heroStrong.transform.position = (doorTargetPosition - heroVerticalPositionOffset);
            heroFast.transform.position = (doorTargetPosition - heroVerticalPositionOffset);
            doorTarget.justTeleported = true;
            yield return new WaitForSeconds(timeToTeleport);
            heroStrong.gameObject.SetActive(true);
            heroFast.gameObject.SetActive(true);
        }

        if(!bothHeroesNeeded)
        {
            hero.gameObject.SetActive(false);
            hero.transform.position = (doorTargetPosition - heroVerticalPositionOffset);
            doorTarget.justTeleported = true;
            yield return new WaitForSeconds(timeToTeleport);
            hero.gameObject.SetActive(true);
        }
    }
Example #7
0
    public override void Start()
    {
        base.Start();
        if (Application.loadedLevel == 1) { mHero = GameObject.Find("Hero").GetComponent<Hero>(); speed = Random.Range(1, 2.01f); }

        sRender.color = new Color(Random.Range(0.10f, 1.1f), Random.Range(0.10f, 1.1f), Random.Range(0.10f, 1.1f));
    }
Example #8
0
    void Awake()
    {
        hero = GetComponent<Hero>();
        rigidbody = GetComponent<Rigidbody2D>();
        anim = GetComponent<Animator>();

    }
Example #9
0
        public static void Init()
        {
            Game.OnUpdate += Game_OnUpdate;
            loaded = false;
            me = null;
            target = null;
            earthshock = null;
            overpower = null;
            enrage = null;
            abyssalBlade = null;
            scytheOfVyse = null;
            blink = null;
            text = new Font(
                Drawing.Direct3DDevice9,
                new FontDescription
                    {
                        FaceName = "Tahoma", Height = 13, OutputPrecision = FontPrecision.Default,
                        Quality = FontQuality.Default
                    });

            Drawing.OnPreReset += Drawing_OnPreReset;
            Drawing.OnPostReset += Drawing_OnPostReset;
            Drawing.OnEndScene += Drawing_OnEndScene;
            AppDomain.CurrentDomain.DomainUnload += CurrentDomainDomainUnload;
            Game.OnWndProc += Game_OnWndProc;
            Orbwalking.Load();
        }
Example #10
0
 /// <summary>
 ///     Checks for lowest hp creep in attack range
 /// </summary>
 /// <param name="source"></param>
 /// <returns></returns>
 public static Unit GetLowestHPCreep(Hero source)
 {
     try
     {
         var attackRange = source.GetAttackRange();
         var lowestHp =
             ObjectMgr.GetEntities<Unit>()
                 .Where(
                     x =>
                     (x.ClassID == ClassID.CDOTA_BaseNPC_Tower || x.ClassID == ClassID.CDOTA_BaseNPC_Creep_Lane
                      || x.ClassID == ClassID.CDOTA_BaseNPC_Creep
                      || x.ClassID == ClassID.CDOTA_BaseNPC_Creep_Neutral
                      || x.ClassID == ClassID.CDOTA_BaseNPC_Creep_Siege
                      || x.ClassID == ClassID.CDOTA_BaseNPC_Additive
                      || x.ClassID == ClassID.CDOTA_BaseNPC_Barracks
                      || x.ClassID == ClassID.CDOTA_BaseNPC_Building
                      || x.ClassID == ClassID.CDOTA_BaseNPC_Creature) && x.IsAlive && x.IsVisible
                     && x.Team != source.Team && x.Distance2D(source) < (attackRange + 100))
                 .OrderBy(creep => creep.Health)
                 .DefaultIfEmpty(null)
                 .FirstOrDefault();
         return lowestHp;
     }
     catch (Exception)
     {
         //no   
     }
     return null;
 }
Example #11
0
    /**
    * {@inheritDoc}
    **/
    public override void Attack(Hero target)
    {
        //CurrentAttackSpeed

        if(LastAttack + CurrentAttackSpeed < Time.time )
        {
            Vector3 vectorToTarget = target.transform.position - transform.position;
            vectorToTarget.z = -vectorToTarget.z;
            //Debug.Log("Dragonnet:"+vectorToTarget);
            //transform.rotation = Quaternion.Slerp(transform.rotation,Quaternion.LookRotation(Camera.main.transform.position),10f);
            GetComponentInChildren<Animation>().CrossFadeQueued("Attack",0.2f);
            PlayAttackSound();
            NbAttack = NbAttack+1;
            LastAttack = Time.time;
            //add attacking BV
            if (fireball == null)
            {
                //loading fireball in the dragonnet
                fireball = Instantiate(fireballGo);
                //fireball.GetComponentInChildren<HeroLinkWeapon>().Hero = hero;
                fireball.transform.parent = transform; //need to attach to this
                //get the lifebar position because dragonnet position is messed up
                fireball.transform.position = this.transform.position; //GetComponentInChildren<Canvas>().transform.position;
                fireball.transform.localPosition = new Vector3(0, 2.3f, 0);
                //fireball.transform.localPosition = new Vector3(0f, 0f, 0f);

            }
        }
    }
Example #12
0
        /// <summary>
        ///     The execute.
        /// </summary>
        /// <param name="hero">
        ///     The hero.
        /// </param>
        /// <returns>
        ///     The <see cref="bool" />.
        /// </returns>
        public bool Execute(Hero hero)
        {
            var fs = Variables.ForceStaff;
            if (!fs.CanHit(hero) || !Utils.SleepCheck(hero.ClassID + "Techies.AutoDetonate"))
            {
                return false;
            }

            double rotSpeed;
            if (Prediction.RotSpeedDictionary.TryGetValue(hero.Handle, out rotSpeed) && rotSpeed > 0
                && Variables.Menu.ForceStaffMenu.Item("checkRotating").GetValue<bool>())
            {
                return false;
            }

            if (Prediction.StraightTime(hero) / 1000
                < Variables.Menu.ForceStaffMenu.Item("straightTime").GetValue<Slider>().Value)
            {
                return false;
            }

            var tempDamage = hero.GetStackDamage(610);
            if (tempDamage.Item1 >= hero.Health)
            {
                fs.UseAbility(hero);
                Utils.Sleep(250, "Techies.ForceStaff");
                return true;
            }

            return false;
        }
Example #13
0
 /// <summary>
 ///     Find enemy hero that takes least hits to kill
 /// </summary>
 /// <param name="source">Source hero</param>
 /// <returns></returns>
 public static Hero BestAutoAttackTarget(Hero source)
 {
     var attackRange = source.GetAttackRange();
     var enemyHeroes =
         ObjectMgr.GetEntities<Hero>()
             .Where(
                 x =>
                 x.Team == source.GetEnemyTeam() && !x.IsIllusion && x.IsAlive && x.IsVisible
                 && x.Distance2D(source) <= (attackRange + x.HullRadius + source.HullRadius + 50));
     var aaDmg = source.MinimumDamage + source.BonusDamage;
     Hero bestTarget = null;
     var lastHitsToKill = 0f;
     foreach (var enemyHero in enemyHeroes)
     {
         var takenDmg = enemyHero.DamageTaken(aaDmg, DamageType.Physical, source, false);
         var hitsToKill = enemyHero.Health / takenDmg;
         if (bestTarget != null && !(lastHitsToKill > hitsToKill))
         {
             continue;
         }
         bestTarget = enemyHero;
         lastHitsToKill = hitsToKill;
     }
     return bestTarget;
 }
Example #14
0
 public override void PickUp(Hero hero)
 {
     if (Open) return;
     Player.Player.Instance.HeroParty.AddConquestTokens(3);
     Open = !Open;
     Texture = openTexture;
 }
 public static void Tick(EventArgs args)
 {
     if (!Game.IsInGame || Game.IsPaused || Game.IsWatchingGame || Game.IsChatOpen)
         return;
     me = ObjectMgr.LocalHero;
     if (me == null)
         return;
     if (me.IsAlive)
     {
         FindItems();
         PercentStickUse = ((double)Menu.Item("Percent Configuration").GetValue<Slider>().Value / 100);
         if ( item_bottle != null && (!me.IsInvisible() || me.ClassID == ClassID.CDOTA_Unit_Hero_Riki) && !me.IsChanneling() && me.Modifiers.Any(x => x.Name == "modifier_fountain_aura_buff") && _item_config.Item("Items: ").GetValue<AbilityToggler>().IsEnabled(item_bottle.Name) && Utils.SleepCheck("bottle"))
         {
             if(!me.Modifiers.Any(x => x.Name == "modifier_bottle_regeneration") && (me.Health < me.MaximumHealth || me.Mana < me.MaximumMana))
                 item_bottle.UseAbility(false);
             Alies = ObjectMgr.GetEntities<Hero>().Where(x => x.Team == me.Team && x != me && (x.Health < x.MaximumHealth || x.Mana < x.MaximumMana) && !x.Modifiers.Any(y => y.Name == "modifier_bottle_regeneration") && x.IsAlive && !x.IsIllusion && x.Distance2D(me) <= item_bottle.CastRange).ToList();
             foreach (Hero v in Alies)
                 if (v != null)
                     item_bottle.UseAbility(v,false);
             Utils.Sleep(300, "bottle");
         }
         if (item_phase_boots != null && (!me.IsInvisible() || me.ClassID == ClassID.CDOTA_Unit_Hero_Riki) && !me.IsChanneling() && item_phase_boots.CanBeCasted() && me.NetworkActivity == NetworkActivity.Move && _item_config.Item("Items: ").GetValue<AbilityToggler>().IsEnabled(item_phase_boots.Name) && Utils.SleepCheck("phaseboots"))
         {
             item_phase_boots.UseAbility(false);
             Utils.Sleep(300, "phaseboots");
         }
         if (item_magic_stick != null && (!me.IsInvisible() || me.ClassID == ClassID.CDOTA_Unit_Hero_Riki) && !me.IsChanneling() && item_magic_stick.CanBeCasted() && item_magic_stick.CurrentCharges > 0 && (double)me.Health / me.MaximumHealth < PercentStickUse && _item_config.Item("Items: ").GetValue<AbilityToggler>().IsEnabled(item_magic_stick.Name))
             item_magic_stick.UseAbility(false);
         if (item_magic_wand != null && (!me.IsInvisible() || me.ClassID == ClassID.CDOTA_Unit_Hero_Riki) && !me.IsChanneling() &&  item_magic_wand.CanBeCasted() && item_magic_wand.CurrentCharges > 0 && (double)me.Health / me.MaximumHealth < PercentStickUse && _item_config.Item("Items: ").GetValue<AbilityToggler>().IsEnabled(item_magic_wand.Name))
             item_magic_wand.UseAbility(false);
     }
 }
Example #16
0
        public static void Init()
        {
            Game.OnUpdate += Game_OnUpdate;
            loaded = false;
            me = null;
            target = null;

            //item
            scytheOfVyse = null;
            blink = null;
            arcane = null;
            orchid = null;
            dagon = null;
            veil = null;
            soulring = null;
            shiva = null;
            text = new Font(
                Drawing.Direct3DDevice9,
                new FontDescription
                {
                    FaceName = "Tahoma",
                    Height = 13,
                    OutputPrecision = FontPrecision.Default,
                    Quality = FontQuality.Default
                });

            Drawing.OnPreReset += Drawing_OnPreReset;
            Drawing.OnPostReset += Drawing_OnPostReset;
            Drawing.OnEndScene += Drawing_OnEndScene;
            AppDomain.CurrentDomain.DomainUnload += CurrentDomainDomainUnload;
            Game.OnWndProc += Game_OnWndProc;
            Orbwalking.Load();

        }
Example #17
0
        public static int CalculateManaRequired(Hero me)
        {
            try
            {
                if (Utils.SleepCheck("manaCalcErrorTimeout"))
                {
                    var hook = me.Spellbook.Spell1;
                    var dismember = me.Spellbook.SpellR;
                    var urn = me.FindItem("item_urn_of_shadows");
                    var eblade = me.FindItem("item_ethereal_blade");
                    var dagon = me.GetDagon();
                    var ManaRequired = 0;

                    if (hook != null)
                        ManaRequired += (int)hook.ManaCost;
                    if (dismember != null)
                        ManaRequired += (int)dismember.ManaCost;
                    if (eblade != null)
                        ManaRequired += (int)eblade.ManaCost;
                    if (dagon != null)
                        ManaRequired += (int)dagon.ManaCost;
                    return (int)ManaRequired;
                }
                return 0;
            }
            catch (Exception ex)
            {
                // Print.Error("MANACALC: " + ex.Message);
                Utils.Sleep(500, "manaCalcErrorTimeout");
                return 0;
            }
        }
    // Use this for initialization
    void Start()
    {
        Hero MyHero = new Hero();
        MyHero.setHP(30);
        MyHero.setMaxHP(30);
        MyHero.setAtk(0);
        MyHero.setType(HERO_TYPE.CSE);
        Material mat;

        if (MyHero.getType() == HERO_TYPE.CSE)
        {
            mat = (Material)Resources.Load("../Material/" + MyHero.getType() + "HeroMaterial.prefab");
            gameObject.GetComponent<Renderer>().material = mat;
        }
        else if (MyHero.getType() == HERO_TYPE.CITE)
        {
            mat = (Material)Resources.Load("../Material/" + MyHero.getType() + "HeroMaterial.prefab");
            gameObject.GetComponent<Renderer>().material = mat;
        }
        else if (MyHero.getType() == HERO_TYPE.EE)
        {
            mat = (Material)Resources.Load("../Material/" + MyHero.getType() + "HeroMaterial.prefab");
            gameObject.GetComponent<Renderer>().material = mat;
        }
        else
        {
            mat = (Material)Resources.Load("../Material/" + MyHero.getType() + "HeroMaterial.prefab");
            gameObject.GetComponent<Renderer>().material = mat;
        }
    }
Example #19
0
    void Start()
    {
        Camera camera = Camera.main;
        Vector3 screenBottomLeft = camera.ScreenToWorldPoint (new Vector3 (0, 0, 0));
        Vector3 screenTopRight = camera.ScreenToWorldPoint (new Vector3 (Screen.width, Screen.height, 0));
        fieldLeft = screenBottomLeft.x;
        fieldRight = screenTopRight.x;
        fieldBottom = 0.1f;
        fieldTop = screenTopRight.y / 2;

        // init rows
        rowWidth = fieldRight - fieldLeft;
        rowHeight = (fieldTop - fieldBottom) / 3;
        row1 = new Vector3 (fieldLeft, fieldBottom + ROW_OFFSET_Y, 0);
        row2 = new Vector3 (fieldLeft, row1.y + rowHeight + ROW_OFFSET_Y, 0);
        row3 = new Vector3 (fieldLeft, row2.y + rowHeight + ROW_OFFSET_Y, 0);

        // init hero
        heroSpawnPos = row2 + new Vector3 (1f, 0, 0);
        GameObject heroObj = (GameObject)Instantiate (heroPrefab, heroSpawnPos, Quaternion.identity);
        hero = heroObj.GetComponent<Hero> ();
        hero.row = 2;

        monsterSpawnPosList.Add (row1 + new Vector3 (rowWidth, 0, 0));
        monsterSpawnPosList.Add (row2 + new Vector3 (rowWidth, 0, 0));
        monsterSpawnPosList.Add (row3 + new Vector3 (rowWidth, 0, 0));

        fieldState = FIELD_STATE_START;
    }
        public void LoadModule(D3Cache cache, Career career, Hero hero)
        {
            if (hero == null)
                return;

            if (hero.Items.MainHand != null)
            {
                Item mainHand = cache.GetFullItem(hero.Items.MainHand, career.Region);
                this.WeaponMainHand.LoadItem(mainHand);
            }
            else
            {
                this.WeaponMainHand.LoadItem(null);
            }

            if (hero.Items.OffHand != null)
            {
                Item offHand = cache.GetFullItem(hero.Items.OffHand, career.Region);
                this.WeaponOffHand.LoadItem(offHand);
            }
            else
            {
                this.WeaponOffHand.LoadItem(null);
            }
        }
Example #21
0
 public EnemyHero(Hero enemy)
 {
     hero = enemy;
     Handle = enemy.Handle;
     ObserversCount = CountObservers();
     SentryCount = CountSentries();
 }
Example #22
0
        public Tree GetChaseTree(
            Hero hero,
            Target target,
            TimberChain timberChain,
            float maxDistanceToEnemy,
            float minDistanceToHero)
        {
            var castRange = timberChain.GetCastRange();
            var targetPosition = target.GetPosition();

            var targetDistance = target.GetDistance(hero.Position);
            var ignoreMaxDistance = targetDistance > castRange + 200;

            var delay = Game.RawGameTime + timberChain.CastPoint + Game.Ping / 1000;
            var trees = GetAvailableTrees(hero, targetPosition, castRange, delay, timberChain.Speed).ToList();

            return
                trees.Where(
                    x =>
                    (ignoreMaxDistance
                     || x.Distance2D(
                         TimberPrediction.PredictedXYZ(
                             target,
                             timberChain.CastPoint + x.Distance2D(targetPosition) / timberChain.Speed))
                     <= maxDistanceToEnemy
                     || (target.Hero.GetTurnTime(x.Position) <= 0 && x.Distance2D(targetPosition) < 600))
                    && x.Distance2D(hero) >= minDistanceToHero)
                    .FirstOrDefault(
                        z =>
                        trees.Where(x => !x.Equals(z))
                            .All(
                                x =>
                                x.Distance2D(hero) > 150 && !IsPointOnLine(x.Position, hero.Position, z.Position, 25)));
        }
Example #23
0
    public Hero CreateHero(HeroClass heroClass)
    {
        Hero hero = new Hero();
        hero.heroName = Strings.RandomNameForClass(heroClass);
        hero.heroClass = heroClass;

        switch (heroClass) {
        case HeroClass.WARRIOR:
            hero.strength = 10;
            hero.dexterity = 5;
            hero.intelligence = 3;
            hero.vitality = 8;

            hero.weapon = GameManager.I.weaponLib.GetWeapon("Sword_Rusty");
            break;
        case HeroClass.BARBARIAN:
            hero.strength = 12;
            hero.dexterity = 4;
            hero.intelligence = 2;
            hero.vitality = 8;

            hero.weapon = GameManager.I.weaponLib.GetWeapon("Hammer_Rusty");
            break;
        case HeroClass.ASSASSIN:
            hero.strength = 6;
            hero.dexterity = 9;
            hero.intelligence = 3;
            hero.vitality = 5;
            break;
        case HeroClass.RANGER:
            hero.strength = 2;
            hero.dexterity = 12;
            hero.intelligence = 4;
            hero.vitality = 2;
            break;
        case HeroClass.WIZARD:
            hero.strength = 1;
            hero.dexterity = 6;
            hero.intelligence = 12;
            hero.vitality = 3;
            break;
        case HeroClass.PRIEST:
            hero.strength = 5;
            hero.dexterity = 2;
            hero.intelligence = 10;
            hero.vitality = 4;
            break;
        default:
            break;
        }

        hero.level = 1;
        hero.maxMana = CalculateMaxMana(hero.intelligence);
        hero.maxHP = CalculateMaxHP(hero.vitality);

        hero.position = GameManager.I.status.heroes.Count;
        hero.id = GameManager.I.status.heroes.Count;

        return hero;
    }
Example #24
0
        public Battle()
        {
            if (story == null)
            {
                this.story = App.Story;
                this.hero = story.Hero;
                currentStatus = null;
            }

            InitializeComponent();

            buttons = new Dictionary<Type, Button>()
            {
                {typeof (Rock), RockButton},
                {typeof (Paper), PaperButton},
                {typeof (Scissors), ScissorsButton},
            };

            foreach (var button in buttons.Values)
            {
                button.Visibility = Visibility.Collapsed;
            }

            returnToNavi.Visibility = Visibility.Collapsed;

            RunBattle();
        }
Example #25
0
 void OnTriggerEnter(Collider other)
 {
     hero = other.gameObject.GetComponent<Hero>();
     if (hero == null) return;
     enter = true;
     hero = other.gameObject.GetComponent<Hero>();
 }
Example #26
0
    public void ProcessHero(Hero hero)
    {
        // get reference
        int totalPoints = 0;
        DungeonFloor floor = floors [currentFloor];

        // calculate total points
        foreach (Item it in hero.H_Inventory) {
            if(floor.checkIfGoodItem(it.name)){
                totalPoints += 50;
            }
            if(floor.checkIfBadItem(it.name)){
                totalPoints -= 30;
            }
        }
        if (hero.HeroClass == floor.goodClass) {
            totalPoints += 20;
        }
        if (hero.HeroClass == floor.badClass) {
            totalPoints -= 20;
        }
        Destroy (hero);

        if (floor.levelPoints > 0) {
            floor.levelPoints -= totalPoints;
        } else {
            floor.bossPoints -= totalPoints;
        }

        if (floor.bossPoints < 0) {
            currentFloor++;
        }
    }
Example #27
0
        private static void Game_OnUpdate(EventArgs args)
        {
            if (target == null) return;
            if (!_loaded)
            {
                if (!Game.IsInGame || me == null || me.ClassID != ClassID.CDOTA_Unit_Hero_PhantomAssassin)
                {
                    return;
                }
            }
                _loaded = true;

                Game.PrintMessage(
                "<font face='Comic Sans MS, cursive'><font color='#00aaff'>" + Menu.DisplayName + " By Bopby" +
                " loaded!</font> <font color='#aa0000'>v" + Assembly.GetExecutingAssembly().GetName().Version,
                MessageType.LogMessage);

            me = ObjectMgr.LocalHero;
            target = me.ClosestToMouseTarget(Menu.Item("targetsearchrange").GetValue<Slider>().Value);
            var handle = me.Handle;
            var distance = me.Distance2D(target);
            var inv = me.Inventory.Items;
            var enumerable = inv as Item[] ?? inv.ToArray();
            var dagger = enumerable.Any(x => x.Name == "item_blink" && x.Cooldown == 0);
            if (!me.IsAlive) return
                    ;
            if (target != null && Menu.Item("keyBind").GetValue<KeyBind>().Active == true)
            {
                SpellsUsage(me, target, distance, dagger);
            }
        }
Example #28
0
    public void HeroPositionChange(Hero hero, int change)
    {
        Debug.Log("HeroPositionUp -- BEFORE - hero.pos: " + hero.position);

        foreach (var item in GameManager.I.status.heroes) {
            print ("hero: " + item.heroName + " , pos: "+ item.position);
        }

        //Change position for other hero (who was in the new position)
        Hero otherHero = GameManager.I.status.heroes.Find(x => x.position == (hero.position + change));
        otherHero.position -= change;
        heroCommanders[otherHero.id].PositionChanged();

        //Change position for hero
        hero.position += change;
        heroCommanders[hero.id].PositionChanged();

        print ("AFTER - hero.pos: " + hero.position);
        foreach (var item in GameManager.I.status.heroes) {
            print ("hero: " + item.heroName + " , pos: "+ item.position);
        }

        //Update UI
        gameCtrl.gameUICtrl.UpdateGameHeroesPanel();
    }
Example #29
0
 public void Init(Hero hero)
 {
     this.hero = hero;
     herostart = hero.transform.position;
     linerenderes = new GameObject[CurrentGameState.completedLevelLocations.Count - 1];
     GameObject lr;
     for (int i = 0; i < CurrentGameState.completedLevelLocations.Count - 1; i++)
     {
         lr = new GameObject();
         lr.AddComponent<LineRenderer>();
         SetupLineRenderer(lr.GetComponent<LineRenderer>(), CurrentGameState.completedLevelLocations[i], CurrentGameState.completedLevelLocations[i + 1]);
         linerenderes[i] = lr;
     }
     if (hero != null)
     {
         lr = new GameObject();
         lr.AddComponent<LineRenderer>();
         SetupLineRenderer(lr.GetComponent<LineRenderer>(), herostart, hero.transform.position);
         herolinerenderer = lr;
         herolinerenderer.GetComponent<LineRenderer>().enabled = false;
     }
     if (origin != null)
     {
         lr = new GameObject();
         lr.AddComponent<LineRenderer>();
         SetupLineRenderer(lr.GetComponent<LineRenderer>(), origin.transform.position, firstPosition.transform.position);
         firstlinerenderer = lr;
     }
 }
Example #30
0
    private void OnGUI()
    {
        if (Game.started)
        {
            Color old = GUI.color;

            GUILayout.Label("Choose hero : ");
            GUILayout.BeginHorizontal();
            foreach(var u in Game.settings.heroesPrefabs) {
                if (u == selected) GUI.color = Color.red;
                if (GUILayout.Button(u.name))
                {
                    selected = u;
                }
                GUI.color = old;
            }
            GUILayout.EndHorizontal();
        }

        if (selected != null)
        {
            if (GUILayout.Button("Validate"))
            {
                Game.LaunchGame(selected);
            }
        }
    }
Example #31
0
 protected void Start()
 {
     this.hero          = Hero.singleton;
     this.clicksEnabled = true;
 }
Example #32
0
 public SurfaceKind GetSurfaceKindUnderHero(Hero hero)
 {
     return(GetSurfaceKindUnderTile(hero));
 }
Example #33
0
 public virtual void OnHeroPlaced(Hero hero)
 {
 }
Example #34
0
        private static void Game_OnUpdate(EventArgs args)
        {
            me = ObjectManager.LocalHero;
            if (!Game.IsInGame || Game.IsWatchingGame || me == null || me.ClassID != ClassID.CDOTA_Unit_Hero_Tiny)
            {
                return;
            }

            if (!Menu.Item("enabled").IsActive())
            {
                return;
            }

            e = me.ClosestToMouseTarget(1800);
            if (e == null)
            {
                return;
            }
            Active = Game.IsKeyDown(Menu.Item("keyBind").GetValue <KeyBind>().Key);

            Q = me.Spellbook.SpellQ;
            W = me.Spellbook.SpellW;

            blink    = me.FindItem("item_blink");
            mom      = me.FindItem("item_mask_of_madness");
            urn      = me.FindItem("item_urn_of_shadows");
            dagon    = me.Inventory.Items.FirstOrDefault(x => x.Name.Contains("item_dagon"));
            ethereal = me.FindItem("item_ethereal_blade");
            halberd  = me.FindItem("item_heavens_halberd");
            mjollnir = me.FindItem("item_mjollnir");
            orchid   = me.FindItem("item_orchid") ?? me.FindItem("item_bloodthorn");
            abyssal  = me.FindItem("item_abyssal_blade");
            mail     = me.FindItem("item_blade_mail");
            bkb      = me.FindItem("item_black_king_bar");
            satanic  = me.FindItem("item_satanic");
            medall   = me.FindItem("item_medallion_of_courage") ?? me.FindItem("item_solar_crest");
            Shiva    = me.FindItem("item_shivas_guard");
            vail     = me.FindItem("item_veil_of_discord");

            var modifEther = e.Modifiers.Any(y => y.Name == "modifier_item_ethereal_blade_slow");
            var stoneModif = e.Modifiers.Any(y => y.Name == "modifier_medusa_stone_gaze_stone");
            var v          =
                ObjectManager.GetEntities <Hero>()
                .Where(x => x.Team != me.Team && x.IsAlive && x.IsVisible && !x.IsIllusion && !x.IsMagicImmune())
                .ToList();
            var isInvisible =
                me.IsInvisible();

            if (Active)
            {
                if (Menu.Item("orbwalk").GetValue <bool>() && me.Distance2D(e) <= 1900)
                {
                    Orbwalking.Orbwalk(e, 0, 1600, true, true);
                }
            }
            if (Active && me.Distance2D(e) <= 1400 && e.IsAlive && !isInvisible)
            {
                float   angle = me.FindAngleBetween(e.Position, true);
                Vector3 pos   = new Vector3((float)(e.Position.X - 100 * Math.Cos(angle)), (float)(e.Position.Y - 100 * Math.Sin(angle)), 0);
                if (
                    blink != null &&
                    Q.CanBeCasted() &&
                    me.CanCast() &&
                    blink.CanBeCasted() &&
                    me.Distance2D(e) >= me.GetAttackRange() + me.HullRadius + 150 &&
                    me.Distance2D(pos) <= 1180 &&
                    Menu.Item("Items").GetValue <AbilityToggler>().IsEnabled(blink.Name) &&
                    Utils.SleepCheck("blink")
                    )
                {
                    blink.UseAbility(pos);
                    Utils.Sleep(250, "blink");
                }
                if (orchid != null && orchid.CanBeCasted() && me.Distance2D(e) <= 900 &&
                    Menu.Item("Items").GetValue <AbilityToggler>().IsEnabled(orchid.Name) && Utils.SleepCheck("orchid"))
                {
                    orchid.UseAbility(e);
                    Utils.Sleep(100, "orchid");
                }
                if (                 // vail
                    vail != null &&
                    vail.CanBeCasted() &&
                    me.CanCast() &&
                    !e.IsMagicImmune() &&
                    Menu.Item("Items").GetValue <AbilityToggler>().IsEnabled(vail.Name) &&
                    me.Distance2D(e) <= 1500 &&
                    Utils.SleepCheck("vail")
                    )
                {
                    vail.UseAbility(e.Position);
                    Utils.Sleep(250, "vail");
                }                 // orchid Item end
                if (ethereal != null && ethereal.CanBeCasted() &&
                    me.Distance2D(e) <= 700 && me.Distance2D(e) <= 400 &&
                    Menu.Item("Items").GetValue <AbilityToggler>().IsEnabled(ethereal.Name) &&
                    Utils.SleepCheck("ethereal"))
                {
                    ethereal.UseAbility(e);
                    Utils.Sleep(100, "ethereal");
                }

                if (                 // Dagon
                    me.CanCast() &&
                    dagon != null &&
                    (ethereal == null ||
                     (modifEther ||
                      ethereal.Cooldown < 17)) &&
                    !e.IsLinkensProtected() &&
                    dagon.CanBeCasted() &&
                    me.Distance2D(e) <= 1400 &&
                    Menu.Item("Items").GetValue <AbilityToggler>().IsEnabled("item_dagon") &&
                    !e.IsMagicImmune() &&
                    !stoneModif &&
                    Utils.SleepCheck("dagon")
                    )
                {
                    dagon.UseAbility(e);
                    Utils.Sleep(200, "dagon");
                }                 // Dagon Item end
                if (
                    Q != null && Q.CanBeCasted() && me.Distance2D(e) <= 1500 &&
                    Menu.Item("Skills").GetValue <AbilityToggler>().IsEnabled(Q.Name) &&
                    Utils.SleepCheck("Q")
                    )
                {
                    Q.UseAbility(e.Predict(400));
                    Utils.Sleep(200, "Q");
                }
                if (
                    W != null && W.CanBeCasted() && me.Distance2D(e) <= 1500 &&
                    Menu.Item("Skills").GetValue <AbilityToggler>().IsEnabled(W.Name) &&
                    Utils.SleepCheck("W")
                    )
                {
                    W.UseAbility(e);
                    Utils.Sleep(200, "W");
                }
                if (                 // MOM
                    mom != null &&
                    mom.CanBeCasted() &&
                    me.CanCast() &&
                    Menu.Item("Items").GetValue <AbilityToggler>().IsEnabled(mom.Name) &&
                    Utils.SleepCheck("mom") &&
                    me.Distance2D(e) <= 700
                    )
                {
                    mom.UseAbility();
                    Utils.Sleep(250, "mom");
                }
                if (                 // Mjollnir
                    mjollnir != null &&
                    mjollnir.CanBeCasted() &&
                    me.CanCast() &&
                    !e.IsMagicImmune() &&
                    Menu.Item("Items").GetValue <AbilityToggler>().IsEnabled(mjollnir.Name) &&
                    Utils.SleepCheck("mjollnir") &&
                    me.Distance2D(e) <= 900
                    )
                {
                    mjollnir.UseAbility(me);
                    Utils.Sleep(250, "mjollnir");
                }                 // Mjollnir Item end
                if (              // Medall
                    medall != null &&
                    medall.CanBeCasted() &&
                    Utils.SleepCheck("Medall") &&
                    Menu.Item("Items").GetValue <AbilityToggler>().IsEnabled(medall.Name) &&
                    me.Distance2D(e) <= 700
                    )
                {
                    medall.UseAbility(e);
                    Utils.Sleep(250, "Medall");
                }                 // Medall Item end


                if (Shiva != null && Shiva.CanBeCasted() && me.Distance2D(e) <= 600 &&
                    Menu.Item("Items").GetValue <AbilityToggler>().IsEnabled(Shiva.Name) &&
                    !e.IsMagicImmune() && Utils.SleepCheck("Shiva"))
                {
                    Shiva.UseAbility();
                    Utils.Sleep(100, "Shiva");
                }
                if (                 // Abyssal Blade
                    abyssal != null &&
                    abyssal.CanBeCasted() &&
                    me.CanCast() &&
                    !e.IsStunned() &&
                    !e.IsHexed() &&
                    Utils.SleepCheck("abyssal") &&
                    Menu.Item("Items").GetValue <AbilityToggler>().IsEnabled(abyssal.Name) &&
                    me.Distance2D(e) <= 400
                    )
                {
                    abyssal.UseAbility(e);
                    Utils.Sleep(250, "abyssal");
                }                 // Abyssal Item end
                if (urn != null && urn.CanBeCasted() && urn.CurrentCharges > 0 && me.Distance2D(e) <= 400 &&
                    Menu.Item("Items").GetValue <AbilityToggler>().IsEnabled(urn.Name) && Utils.SleepCheck("urn"))
                {
                    urn.UseAbility(e);
                    Utils.Sleep(240, "urn");
                }
                if (                 // Hellbard
                    halberd != null &&
                    halberd.CanBeCasted() &&
                    me.CanCast() &&
                    !e.IsMagicImmune() &&
                    (e.NetworkActivity == NetworkActivity.Attack ||
                     e.NetworkActivity == NetworkActivity.Crit ||
                     e.NetworkActivity == NetworkActivity.Attack2) &&
                    Utils.SleepCheck("halberd") &&
                    me.Distance2D(e) <= 700 &&
                    Menu.Item("Items").GetValue <AbilityToggler>().IsEnabled(halberd.Name)
                    )
                {
                    halberd.UseAbility(e);
                    Utils.Sleep(250, "halberd");
                }
                if (                 // Satanic
                    satanic != null &&
                    me.Health <= (me.MaximumHealth * 0.3) &&
                    satanic.CanBeCasted() &&
                    me.Distance2D(e) <= me.AttackRange + 50 &&
                    Menu.Item("Items").GetValue <AbilityToggler>().IsEnabled(satanic.Name) &&
                    Utils.SleepCheck("satanic")
                    )
                {
                    satanic.UseAbility();
                    Utils.Sleep(240, "satanic");
                }                 // Satanic Item end
                if (mail != null && mail.CanBeCasted() && (v.Count(x => x.Distance2D(me) <= 650) >=
                                                           (Menu.Item("Heelm").GetValue <Slider>().Value)) &&
                    Menu.Item("Items").GetValue <AbilityToggler>().IsEnabled(mail.Name) && Utils.SleepCheck("mail"))
                {
                    mail.UseAbility();
                    Utils.Sleep(100, "mail");
                }
                if (bkb != null && bkb.CanBeCasted() && (v.Count(x => x.Distance2D(me) <= 650) >=
                                                         (Menu.Item("Heel").GetValue <Slider>().Value)) &&
                    Menu.Item("Items").GetValue <AbilityToggler>().IsEnabled(bkb.Name) && Utils.SleepCheck("bkb"))
                {
                    bkb.UseAbility();
                    Utils.Sleep(100, "bkb");
                }
            }
        }
Example #35
0
    /* Save current game state */
    public bool SaveGame(Hero H, int slot)
    {
        /* Create 'Save' folder if not already created */
        FileInfo FileDir = new System.IO.FileInfo("./GameData/Save/");

        FileDir.Directory.Create();
        string Slot;

        /* Generating slot filename */
        Slot = "./GameData/Save/slot" + slot + ".sav";

        if (File.Exists(Slot))
        {
            File.Delete(Slot);
        }

        /* Open a new filestream */
        FileStream Stream = new FileStream(Slot, FileMode.OpenOrCreate, FileAccess.Write);

        DESCryptoServiceProvider Crypto = new DESCryptoServiceProvider();

        /* Key only used to avoid simple editing of save file */
        Crypto.Key = ASCIIEncoding.ASCII.GetBytes("MURGALHA");
        Crypto.IV  = ASCIIEncoding.ASCII.GetBytes("MURGALHA");

        CryptoStream CrStream = new CryptoStream(Stream,
                                                 Crypto.CreateEncryptor(), CryptoStreamMode.Write);

        /* String 'Data' receives every information that needs to be saved for a later load */
        /* Append player characteristics separating with comma */
        string Data = H.Name + "," + H.Race + "," + H.Strength + "," + H.Ability + "," + H.Resistance + "," + H.Armor + "," + H.Firepower + "," + H.Exp + "," + H.Level + "," + H.Gold + "," + H.Bag.Size + ",";

        /* Saving every inventory item */
        foreach (var It in H.Bag.Inventory)
        {
            Data += It.Name + "," + It.Type + "," + It.Category + "," + It.Buff + "," + It.Value + ",";
        }

        /* Saving every equipped item on save file */
        if (H.Equip.Head != null)
        {
            Data += "1,";
            Data += H.Equip.Head.Name + "," + H.Equip.Head.Type + "," + H.Equip.Head.Category + "," + H.Equip.Head.Buff + "," + H.Equip.Head.Value + ",";
        }
        else
        {
            Data += "0,";
        }

        if (H.Equip.Torso != null)
        {
            Data += "1,";
            Data += H.Equip.Torso.Name + "," + H.Equip.Torso.Type + "," + H.Equip.Torso.Category + "," + H.Equip.Torso.Buff + "," + H.Equip.Torso.Value + ",";
        }
        else
        {
            Data += "0,";
        }

        if (H.Equip.Hand != null)
        {
            Data += "1,";
            Data += H.Equip.Hand.Name + "," + H.Equip.Hand.Type + "," + H.Equip.Hand.Category + "," + H.Equip.Hand.Buff + "," + H.Equip.Hand.Value + ",";
        }
        else
        {
            Data += "0,";
        }

        if (H.Equip.Leg != null)
        {
            Data += "1,";
            Data += H.Equip.Leg.Name + "," + H.Equip.Leg.Type + "," + H.Equip.Leg.Category + "," + H.Equip.Leg.Buff + "," + H.Equip.Leg.Value + ",";
        }
        else
        {
            Data += "0,";
        }

        if (H.Weapon != null)
        {
            Data += "1,";
            Data += H.Equip.Weapon.Name + "," + H.Equip.Weapon.Type + "," + H.Equip.Weapon.Category + "," + H.Equip.Weapon.Buff + "," + H.Equip.Weapon.Value;
        }
        else
        {
            Data += "0";
        }

        /* Write the string 'Data' into file */
        byte[] EncodedData = ASCIIEncoding.ASCII.GetBytes(Data);

        CrStream.Write(EncodedData, 0, EncodedData.Length);

        CrStream.Close();
        Stream.Close();

        return(true);
    }
Example #36
0
    /* Load game based on the slot chosen */
    public Hero LoadGame(int slot)
    {
        string Slot;

        Slot = String.Join("", "./GameData/Save/slot", slot, ".sav");

        /* if file exists, can't be loaded */
        if (!File.Exists(Slot))
        {
            return(null);
        }

        FileStream Stream = new FileStream(Slot, FileMode.Open, FileAccess.Read);
        DESCryptoServiceProvider Crypto = new DESCryptoServiceProvider();

        /* Key only used to avoid simple editing of save file */
        Crypto.Key = ASCIIEncoding.ASCII.GetBytes("MURGALHA");
        Crypto.IV  = ASCIIEncoding.ASCII.GetBytes("MURGALHA");

        CryptoStream CrStream = new CryptoStream(Stream,
                                                 Crypto.CreateDecryptor(), CryptoStreamMode.Read);

        StreamReader Reader = new StreamReader(CrStream);

        /* Get every file on a string, to then be split with ',' */
        string Data = Reader.ReadToEnd();

        Reader.Close();
        Stream.Close();

        /* Splitting data and setting characteristics */
        string[] Tokens = Data.Split(',');

        int    Strength, Ability, Resistance, Armor, Firepower;
        int    Exp, Gold, Level, i, k = 0;
        string Name = Tokens[k++];
        string Race = Tokens[k++];

        Strength   = Int32.Parse(Tokens[k++]);
        Ability    = Int32.Parse(Tokens[k++]);
        Resistance = Int32.Parse(Tokens[k++]);
        Armor      = Int32.Parse(Tokens[k++]);
        Firepower  = Int32.Parse(Tokens[k++]);

        Hero H = new Hero(Strength, Ability, Resistance, Armor, Firepower, Name, Race);

        /* Setting player status */
        Exp   = Int32.Parse(Tokens[k++]);
        Level = Int32.Parse(Tokens[k++]);
        Gold  = Int32.Parse(Tokens[k++]);

        H.Exp   = Exp;
        H.Level = Level;
        H.Gold  = Gold;

        /* Loading every item from inventory */
        int Size = Int32.Parse(Tokens[k++]);

        for (i = 0; i < Size; i++)
        {
            Item It = LoadItem(Tokens, k);
            k += 5;
            H.PickItem(It);
        }

        /* loading every equipped item */
        for (i = 0; i < 5; i++)
        {
            if (Tokens[k++] == "1")
            {
                Item It = LoadItem(Tokens, k);
                k += 5;
                H.PickItem(It);
                H.EquipFromBag(It.Name);
            }
        }

        return(H);
    }
Example #37
0
 public virtual bool CanBeCasted(EvadableAbility ability, Unit unit)
 {
     return(!Sleeper.Sleeping && Ability.CanBeCasted() && Hero.Distance2D(unit) <= GetCastRange() &&
            CheckEnemy(unit));
 }
Example #38
0
    // Update is called once per frame
    void Update()
    {
        if (DataManager.instance.gameState == GameState.None)
        {
            if (MapManager.GetAllHeroes().Count >= DataManager.instance.heroToSpawn.Count)
            {
                DataManager.instance.StartGame();
            }
        }


        if (DataManager.instance.gameState == GameState.Playing &&
            !EventSystem.current.IsPointerOverGameObject() && // cursor is not over an UI element
            Input.GetMouseButtonDown(0))
        {
            Vector3Int tilePos    = MapManager.GetTileUnderMouse();
            Hero       heroOnTile = MapManager.GetHeroAtTile(tilePos);

            if (heroOnTile != null)
            {
                onHeroClicked.Invoke(heroOnTile);
            }


            if (selectedHero == null || !selectedHero.canPlay || selectedHero.team != DataManager.instance.teamPlaying)
            {
                DataManager.instance.audio["Game/TileClicked"].Play();
                SelectHero(heroOnTile);
            }
            else if (selectedHero.canPlay)
            {
                TileClass tile = reachableTiles.Find(x => x.position == tilePos);
                if (tile != null)
                {
                    switch (tile.type)
                    {
                    case TileType.Walkable:
                        if (posChanged && selectedTile == tilePos)
                        {
                            DataManager.instance.audio["Game/HeroPlayed"].Play();
                            selectedHero.position = tilePos;
                            selectedHero.canPlay  = false;
                            DeselectHero();
                        }
                        else if (tile.enabled)
                        {
                            DataManager.instance.audio["Game/MoveHero"].Play();
                            selectedHero.targetPosition = tilePos;
                            posChanged   = true;
                            selectedTile = tilePos;
                            tileSelection.transform.position = MapManager.GetTileCenter(tilePos);
                            FillPath(tile);
                        }
                        else if (heroOnTile == selectedHero)
                        {
                            DeselectHero();
                        }
                        break;

                    case TileType.Attackable:
                        TileClass destTile = Utils.GetFirstWalkableTile(tile);
                        if (destTile == null)
                        {
                            // i've don't implemented this situation...
                        }
                        else if (posChanged && selectedTile == tilePos)
                        {
                            DataManager.instance.audio["Game/HeroPlayed"].Play();
                            battle.Attack(selectedHero, heroOnTile);
                            selectedHero.position = destTile.position;
                            selectedHero.canPlay  = false;
                            DeselectHero();
                        }
                        else if (tile.enabled)
                        {
                            DataManager.instance.audio["Game/AttackClicked"].Play();
                            selectedHero.targetPosition = destTile.position;
                            posChanged   = true;
                            selectedTile = tilePos;
                            tileSelection.transform.position = MapManager.GetTileCenter(tilePos);
                            FillPath(destTile);
                        }
                        break;

                    default: break;
                    }
                }
                else if (heroOnTile == null)
                {
                    DataManager.instance.audio["Game/HeroDeselect"].Play();
                    DeselectHero();
                }
            }
        }
    }
Example #39
0
        private void CheckSkillShots()
        {
            if (!skillShotChecked)
            {
                skillShotChecked = true;
                Utility.DelayAction.Add(70, () => skillShotChecked = false);
                for (var i = 0; i < SkillshotDetector.ActiveSkillshots.Count; i++)
                {
                    if (
                        CombatHelper.BuffsList.Any(
                            b =>
                            SkillshotDetector.ActiveSkillshots[i].SkillshotData.Slot == b.Slot &&
                            ((AIHeroClient)SkillshotDetector.ActiveSkillshots[i].Caster).ChampionName ==
                            b.ChampionName))
                    {
                        SkillshotDetector.ActiveSkillshots.RemoveAt(i);
                        break;
                    }
                    foreach (var Hero in
                             HeroManager.AllHeroes.Where(
                                 h =>
                                 h.Distance(SkillshotDetector.ActiveSkillshots[i].Caster) <
                                 SkillshotDetector.ActiveSkillshots[i].SkillshotData.Range)
                             .OrderBy(h => h.Distance(SkillshotDetector.ActiveSkillshots[i].Caster)))
                    {
                        SkillshotDetector.ActiveSkillshots[i].Game_OnGameUpdate();
                        if (SkillshotDetector.ActiveSkillshots[i].Caster.NetworkId != Hero.NetworkId &&
                            SkillshotDetector.ActiveSkillshots[i].Caster.Team != Hero.Team &&
                            !SkillshotDetector.ActiveSkillshots[i].IsSafePath(
                                0, -1, SkillshotDetector.ActiveSkillshots[i].SkillshotData.Delay, Hero).IsSafe&&
                            Hero.IsValidTarget(1500, false, Hero.Position) &&
                            SkillshotDetector.ActiveSkillshots[i].IsAboutToHit(
                                510, Hero, SkillshotDetector.ActiveSkillshots[i].Caster))
                        {
                            var data =
                                IncomingDamagesAlly.Concat(IncomingDamagesEnemy)
                                .FirstOrDefault(h => h.Hero.NetworkId == Hero.NetworkId);
                            var missileSpeed =
                                SkillshotDetector.ActiveSkillshots[i].GetMissilePosition(0).Distance(Hero) /
                                SkillshotDetector.ActiveSkillshots[i].SkillshotData.MissileSpeed;
                            missileSpeed = missileSpeed > 5f ? 5f : missileSpeed;
                            var newData = new Dmg(
                                Hero,
                                (float)
                                ((AIHeroClient)SkillshotDetector.ActiveSkillshots[i].Caster).LSGetSpellDamage(Hero,
                                                                                                              SkillshotDetector.ActiveSkillshots[i].SkillshotData.Slot), missileSpeed, false,
                                false, SkillshotDetector.ActiveSkillshots[i]);
                            if (data == null ||
                                data.Damages.Any(
                                    d =>
                                    d.SkillShot != null &&
                                    d.SkillShot.Caster.NetworkId ==
                                    SkillshotDetector.ActiveSkillshots[i].Caster.NetworkId &&
                                    d.SkillShot.SkillshotData.SpellName ==
                                    SkillshotDetector.ActiveSkillshots[i].SkillshotData.SpellName &&
                                    SkillshotDetector.ActiveSkillshots[i].SkillshotData.PossibleTargets.Any(
                                        h => h == Hero.NetworkId)))
                            {
                                continue;
                            }
                            if (data != null && data.Hero != Hero)
                            {
                                if (
                                    SkillshotDetector.ActiveSkillshots[i].SkillshotData.CollisionObjects.Count(
                                        c => c != CollisionObjectTypes.YasuoWall) > 0)
                                {
                                    /* Console.WriteLine(
                                     *  SkillshotDetector.ActiveSkillshots[i].SkillshotData.SpellName + " -> " +
                                     *  Hero.Name + " - " +
                                     *  SkillshotDetector.ActiveSkillshots[i].SkillshotData.IsDangerous);*/
                                    data.Damages.Add(newData);
                                    SkillshotDetector.ActiveSkillshots[i].SkillshotData.PossibleTargets.Add(
                                        Hero.NetworkId);
                                    SkillshotDetector.ActiveSkillshots.RemoveAt(i);
                                    break;
                                }

                                /*Console.WriteLine(
                                 *      SkillshotDetector.ActiveSkillshots[i].SkillshotData.SpellName + " --> " +
                                 *      Hero.Name + " - " +
                                 *      SkillshotDetector.ActiveSkillshots[i].SkillshotData.IsDangerous);*/
                                data.Damages.Add(newData);
                                SkillshotDetector.ActiveSkillshots[i].SkillshotData.PossibleTargets.Add(
                                    Hero.NetworkId);
                            }
                        }
                    }
                }
            }
        }
    public string HeroSkillTooltip(Hero hero)
    {
        StringBuilder sb = ToolTipManager.TipBody;
        sb.AppendFormat("<color={0}>", DarkestDungeonManager.Data.HexColors["notable"]);
        sb.Append(LocalizationManager.GetString(ToolTipManager.GetConcat("combat_skill_name_", hero.HeroClass.StringId, "_", Id)));
        sb.AppendFormat("</color><color={0}>", DarkestDungeonManager.Data.HexColors["neutral"]);
        
        
        if(TargetRanks.IsRandomTarget)
        {
            sb.Append("\n" + LocalizationManager.GetString("skill_random_target"));
        }

        if(Type != null)
        {
            sb.Append("\n" + LocalizationManager.GetString("str_" + Type));
        }




        if (Heal != null)
        {
            if(TargetRanks.IsSelfFormation && TargetRanks.IsMultitarget)
                sb.AppendFormat("\n" + LocalizationManager.GetString("skill_party_heal_format"), Heal.MinAmount, Heal.MaxAmount);
            else
                sb.AppendFormat("\n" + LocalizationManager.GetString("skill_heal_format"), Heal.MinAmount, Heal.MaxAmount);
        }

        if (Move != null)
        {
            if(Move.Pullforward != 0)
                sb.AppendFormat("\n" + LocalizationManager.GetString("str_skill_tooltip_forward"), Move.Pullforward);
            else if (Move.Pushback != 0)
                sb.AppendFormat("\n" + LocalizationManager.GetString("str_skill_tooltip_back"), Move.Pushback);
        }

        if (Accuracy != 0)
        {
            sb.AppendFormat("\n" + LocalizationManager.GetString("str_skill_tooltip_acc_base"), Accuracy * 100);
        }

        if (DamageMod != 0)
        {
            sb.AppendFormat("\n" + LocalizationManager.GetString("str_skill_tooltip_dmg_mod"), DamageMod * 100);
        }

        if (CritMod != 0)
        {
            sb.AppendFormat("\n" + LocalizationManager.GetString("str_skill_tooltip_crit_mod"), CritMod * 100);
        }

        bool hasTargetLabel = false;
        bool hasSelfLabel = false;
        bool hasPartyLabel = false;
        bool hasPartyOtherLabel = false;

        if(ValidModes.Count > 1)
        {
            foreach (var modeName in ValidModes)
            {
                hasTargetLabel = false;
                hasSelfLabel = false;
                hasPartyLabel = false;
                hasPartyOtherLabel = false;

                if (!ModeEffects.ContainsKey(modeName))
                    continue;

                sb.Append("\n" + LocalizationManager.GetString("str_skill_mode_info_" + modeName));

                #region Effects
                foreach (var effect in ModeEffects[modeName])
                {
                    switch (effect.TargetType)
                    {
                        case EffectTargetType.Target:
                            if (TargetRanks.IsSelfFormation && TargetRanks.IsMultitarget && TargetRanks.Ranks.Count == 4)
                            {
                                if (hasPartyLabel)
                                    break;
                                sb.Append("\n" + LocalizationManager.GetString("effect_tooltip_party"));
                                hasPartyLabel = true;
                            }
                            else if (TargetRanks.IsSelfTarget)
                            {
                                if (hasSelfLabel)
                                    break;
                                sb.Append("\n" + LocalizationManager.GetString("effect_tooltip_self"));
                                hasSelfLabel = true;
                            }
                            else
                            {
                                if (hasTargetLabel)
                                    break;
                                sb.Append("\n" + LocalizationManager.GetString("effect_tooltip_target"));
                                hasTargetLabel = true;
                            }
                            break;
                        case EffectTargetType.Performer:
                            if (hasSelfLabel)
                                break;
                            sb.Append("\n" + LocalizationManager.GetString("effect_tooltip_self"));
                            hasSelfLabel = true;
                            break;
                        case EffectTargetType.PerformersOther:
                            if (hasPartyOtherLabel)
                                break;
                            sb.Append("\n" + LocalizationManager.GetString("effect_tooltip_party_other"));
                            hasPartyOtherLabel = true;
                            break;
                        default:
                            break;
                    }
                    string effectTooltip = effect.Tooltip();
                    if (effectTooltip.Length > 0)
                        sb.Append("\n" + effectTooltip);
                }
                #endregion
            }
        }

        #region Effects
        foreach (var effect in Effects)
        {
            switch(effect.TargetType)
            {
                case EffectTargetType.Target:
                    if (TargetRanks.IsSelfFormation && TargetRanks.IsMultitarget && TargetRanks.Ranks.Count == 4)
                    {
                        if (hasPartyLabel)
                            break;
                        sb.Append("\n" + LocalizationManager.GetString("effect_tooltip_party"));
                        hasPartyLabel = true;
                    }
                    else if (TargetRanks.IsSelfTarget)
                    {
                        if (hasSelfLabel)
                            break;
                        sb.Append("\n" + LocalizationManager.GetString("effect_tooltip_self"));
                        hasSelfLabel = true;
                    }
                    else
                    {
                        if (hasTargetLabel)
                            break;
                        sb.Append("\n" + LocalizationManager.GetString("effect_tooltip_target"));
                        hasTargetLabel = true;
                    }
                    break;
                case EffectTargetType.Performer:
                    if (hasSelfLabel)
                        break;
                    sb.Append("\n" + LocalizationManager.GetString("effect_tooltip_self"));
                    hasSelfLabel = true;
                    break;
                case EffectTargetType.PerformersOther:
                    if (hasPartyOtherLabel)
                        break;
                    sb.Append("\n" + LocalizationManager.GetString("effect_tooltip_party_other"));
                    hasPartyOtherLabel = true;
                    break;
                default:
                    break;
            }
            string effectTooltip = effect.Tooltip();
            if(effectTooltip.Length > 0)
                sb.Append("\n" + effectTooltip);
        }
        #endregion

        sb.Append("</color>");
        return sb.ToString();
    }
Example #41
0
//        private static void Drawing_OnDraw(EventArgs args)
//        {
//            var player = ObjectMgr.LocalPlayer;
//            if (player == null || player.Team == Team.Observer || !_loaded)
//            {
//                return;
//            }
//            if (ObjectMgr.LocalHero.ClassID != ClassID.CDOTA_Unit_Hero_StormSpirit) return;
//            var startPos = new Vector2(50, 200);
//            var maxSize = new Vector2(120, 100);
//            if (_showMenu)
//            {
//                _sizer.X += 4;
//                _sizer.Y += 4;
//                _sizer.X = Math.Min(_sizer.X, maxSize.X);
//                _sizer.Y = Math.Min(_sizer.Y, maxSize.Y);
//
//                Drawing.DrawRect(startPos, _sizer, new Color(0, 155, 255, 100));
//                Drawing.DrawRect(startPos, _sizer, new Color(0, 0, 0, 255), true);
//                Drawing.DrawRect(startPos + new Vector2(-5, -5), _sizer + new Vector2(10, 10),
//                    new Color(0, 0, 0, 255), true);
//                DrawButton(startPos + new Vector2(_sizer.X - 20, -20), 20, 20, ref _showMenu, true, Color.Gray,
//                    Color.Gray);
//                if (!Equals(_sizer, maxSize)) return;
//                /*
//                DrawButton(startPos + new Vector2(10, 10), 100, 20, ref _shouldUseDagger, true,
//                    new Color(0, 200, 150),
//                    new Color(200, 0, 0, 100), "Dagger On Start");
//                */
//                DrawButton(startPos + new Vector2(10, _sizer.Y - 70), 100, 20, ref _timetochange, true,
//                    new Color(0, 200, 150),
//                    new Color(200, 0, 0, 100), "Change Hotkey");
//
//                Drawing.DrawText(
//                    string.Format("Status: [{0}]", GoAction ? "ON" : "OFF"),
//                    startPos + new Vector2(10, _sizer.Y - 35), Color.White,
//                    FontFlags.AntiAlias | FontFlags.DropShadow);
//                Drawing.DrawText(string.Format("ComboKey {0}", (char)_useComboKey),
//                    startPos + new Vector2(10, _sizer.Y - 20), Color.White,
//                    FontFlags.AntiAlias | FontFlags.DropShadow);
//            }
//            else
//            {
//                _sizer.X -= 4;
//                _sizer.Y -= 4;
//                _sizer.X = Math.Max(_sizer.X, 20);
//                _sizer.Y = Math.Max(_sizer.Y, 0);
//                Drawing.DrawRect(startPos, _sizer, new Color(0, 155, 255, 100));
//                Drawing.DrawRect(startPos, _sizer, new Color(0, 0, 0, 255), true);
//                DrawButton(startPos + new Vector2(_sizer.X - 20, -20), 20, 20, ref _showMenu, true, Color.Gray,
//                    Color.Gray);
//            }
//        }

/*
 *      private static void Game_OnWndProc(WndEventArgs args)
 *      {
 *          if (Game.IsChatOpen || !_loaded)
 *              return;
 *          if (_timetochange && args.Msg == WmKeyup && args.WParam >= 0x41 && args.WParam <= 0x5A)
 *          {
 *              _timetochange = false;
 *              _useComboKey = args.WParam;
 *              return;
 *          }
 *
 *          if (args.WParam == _useComboKey)
 *          {
 *              GoAction = args.Msg != WmKeyup;
 *              if (GoAction != _lastStateAction)
 *              {
 *                  _lastStateAction = GoAction;
 *                  Game.ExecuteCommand(string.Format("dota_player_units_auto_attack_after_spell {0}", GoAction ? 0 : 1));
 *              }
 *              if (!GoAction)
 *              {
 *                  EnemyTargetHero = null;
 *              }
 *          }
 *          if (args.WParam != 1 || !Utils.SleepCheck("clicker"))
 *          {
 *              _leftMouseIsPress = false;
 *              return;
 *          }
 *          _leftMouseIsPress = true;
 *      }
 */

        private static void Game_OnUpdate(EventArgs args)
        {
            #region check

            var me = ObjectMgr.LocalHero;

            if (!_loaded)
            {
                if (!Game.IsInGame || me == null)
                {
                    return;
                }
                if (me.ClassID == ClassID.CDOTA_Unit_Hero_StormSpirit)
                {
                    _loaded = true;
                    PrintSuccess("> Storm Annihilation loaded! v" + Ver);
                }
            }

            if (!Game.IsInGame || me == null)
            {
                _loaded = false;
                PrintInfo("> Storm Annihilation unLoaded");
                return;
            }

            #endregion


            if (!Menu.Item("hotkey").GetValue <KeyBind>().Active)
            {
                EnemyTargetHero = null;
                return;
            }

            //if (!GoAction) return;

            if (EnemyTargetHero == null || !EnemyTargetHero.IsValid)
            {
                EnemyTargetHero = ClosestToMouse(me, 150);
            }
            if (EnemyTargetHero == null || !EnemyTargetHero.IsValid || !EnemyTargetHero.IsAlive || !me.CanCast())
            {
                return;
            }

            var zip = me.Spellbook.Spell4;
            if (zip == null || zip.Level == 0)
            {
                return;
            }
            var inUltimate    = me.Modifiers.Any(x => x.Name == "modifier_storm_spirit_ball_lightning");
            var inPassve      = me.Modifiers.Any(x => x.Name == "modifier_storm_spirit_overload");
            var zipLevel      = zip.Level;
            var distance      = me.Distance2D(EnemyTargetHero);
            var travelSpeed   = TravelSpeeds[zipLevel - 1];
            var damage        = DamagePerUnit[zipLevel - 1];
            var damageRadius  = 50 + 75 * zipLevel;
            var startManaCost = 30 + me.MaximumMana * 0.08;
            var costPerUnit   = (12 + me.MaximumMana * 0.007) / 100.0;

            var totalCost = (int)(startManaCost + costPerUnit * (int)Math.Floor((decimal)distance / 100) * 100);

            var travelTime = distance / travelSpeed;

            var enemyHealth = EnemyTargetHero.Health;
            _remainingMana = me.Mana - totalCost + (me.ManaRegeneration * (travelTime + 1));

            var hpPerc = me.Health / (float)me.MaximumHealth;
            var mpPerc = me.Mana / me.MaximumMana;
            if (Utils.SleepCheck("mana_items"))
            {
                var soulring = me.FindItem("item_soul_ring");
                if (soulring != null && soulring.CanBeCasted() && hpPerc >= .1 && mpPerc <= .7)
                {
                    soulring.UseAbility();
                    Utils.Sleep(200, "mana_items");
                }
                var stick = me.FindItem("item_magic_stick") ?? me.FindItem("item_magic_wand");
                if (stick != null && stick.CanBeCasted() && stick.CurrentCharges != 0 && (mpPerc <= .5 || hpPerc <= .5))
                {
                    stick.UseAbility();
                    Utils.Sleep(200, "mana_items");
                }
            }

            #region Ultimate and Attack

            if (!inUltimate && Utils.SleepCheck("castUlt"))
            {
                if (inPassve && distance < me.AttackRange)
                {
                    if (Utils.SleepCheck("Attacking") && !me.IsAttacking())
                    {
                        me.Attack(EnemyTargetHero);
                        Utils.Sleep(me.AttackSpeedValue, "Attacking");
                    }
                }
                else if (_remainingMana > 0)
                {
                    if (distance >= Menu.Item("minrange").GetValue <Slider>().Value&& Utils.SleepCheck("Attacking"))
                    {
                        if (distance >= damageRadius)
                        {
                            zip.UseAbility(Prediction.SkillShotXYZ(me, EnemyTargetHero, (float)zip.FindCastPoint(),
                                                                   travelSpeed,
                                                                   damageRadius)); //TODO mb more accurate
                            me.Attack(EnemyTargetHero, true);
                        }
                        else
                        {
                            zip.UseAbility(me.Position);
                            me.Attack(EnemyTargetHero, true);
                        }
                        Utils.Sleep(Menu.Item("castUlt").GetValue <Slider>().Value, "castUlt");
                    }
                    else
                    {
                        me.Attack(EnemyTargetHero);
                        Utils.Sleep(750, "Attacking");
                    }
                }
            }

            #endregion

            _totalDamage = (int)(damage * distance);
            _totalDamage = (int)EnemyTargetHero.DamageTaken(_totalDamage, DamageType.Magical, me);

            if (enemyHealth < _totalDamage)
            {
                return;                             //target ll die only from ultimate
            }
            #region items

            if (Utils.SleepCheck("items"))
            {
                var hex    = me.FindItem("item_sheepstick");
                var orchid = me.FindItem("item_orchid");
                if (hex != null && hex.CanBeCasted(EnemyTargetHero) && !EnemyTargetHero.IsHexed() && !EnemyTargetHero.IsStunned())
                {
                    hex.UseAbility(EnemyTargetHero);
                    Utils.Sleep(250, "items");
                }
                else if (orchid != null && orchid.CanBeCasted(EnemyTargetHero) && !EnemyTargetHero.IsHexed() && !EnemyTargetHero.IsSilenced() &&
                         !EnemyTargetHero.IsStunned())
                {
                    orchid.UseAbility(EnemyTargetHero);
                    Utils.Sleep(250, "items");
                }

                var shiva = me.FindItem("item_shivas_guard");
                if (shiva != null && shiva.CanBeCasted() && distance <= 900)
                {
                    shiva.UseAbility();
                    Utils.Sleep(250, "items");
                }
                var dagon = me.GetDagon();

                /*me.FindItem("item_dagon")
                 *  ?? me.FindItem("item_dagon_2")
                 *  ?? me.FindItem("item_dagon_3") ?? me.FindItem("item_dagon_4") ?? me.FindItem("item_dagon_5");*/
                if (dagon != null && dagon.CanBeCasted(EnemyTargetHero) && distance <= dagon.CastRange)
                {
                    dagon.UseAbility(EnemyTargetHero);
                    Utils.Sleep(250, "items");
                }
                if (shiva != null && shiva.CanBeCasted() && distance <= 900)
                {
                    shiva.UseAbility();
                    Utils.Sleep(250, "items");
                }
            }

            #endregion

            #region Spells

            if (Utils.SleepCheck("spells"))
            {
                var remnant = me.Spellbook.Spell1;
                var vortex  = me.Spellbook.Spell2;
                if (remnant != null && remnant.CanBeCasted() && distance < 260)
                {
                    remnant.UseAbility();
                    Utils.Sleep(250, "spells");
                }
                else if (vortex != null && vortex.CanBeCasted(EnemyTargetHero) && distance < vortex.CastRange && !EnemyTargetHero.IsHexed() &&
                         !EnemyTargetHero.IsStunned())
                {
                    vortex.UseAbility(EnemyTargetHero);
                    Utils.Sleep(250, "spells");
                }
            }

            #endregion

            #region Dodging

            if (!Menu.Item("usemanta").GetValue <bool>())
            {
                return;
            }
            var mantaMod =
                me.Modifiers.Any(
                    x =>
                    x.Name == "modifier_orchid_malevolence_debuff" || x.Name == "modifier_lina_laguna_blade" ||
                    x.Name == "modifier_pudge_meat_hook" || x.Name == "modifier_skywrath_mage_ancient_seal" ||
                    x.Name == "modifier_lion_finger_of_death");
            if (!mantaMod)
            {
                return;
            }
            var manta = me.FindItem("item_manta");
            if (manta == null || !manta.CanBeCasted() || (!Utils.SleepCheck("dispell")))
            {
                return;
            }
            manta.UseAbility();
            Utils.Sleep(250, "dispell");

            #endregion
        }
Example #42
0
 public override float GetRemainingTime(Hero hero = null)
 {
     return(0);
 }
 void heroSlot_OnHeroDropped(Hero hero)
 {
     heroOverview.gameObject.SetActive(true);
     heroOverview.LoadHeroOverview(hero);
     dragHeroLabel.enabled = false;
 }
Example #44
0
        private void hover_token_changed(object sender, EventArgs e)
        {
            SplitContainer item    = base.Controls[0] as SplitContainer;
            MapView        mapView = item.Panel1.Controls[0] as MapView;

            this.fParentMap.HoverToken = mapView.HoverToken;
            string category = "";
            string str      = null;

            if (mapView.HoverToken is CreatureToken)
            {
                CreatureToken hoverToken    = mapView.HoverToken as CreatureToken;
                EncounterSlot encounterSlot = mapView.Encounter.FindSlot(hoverToken.SlotID);
                ICreature     creature      = Session.FindCreature(encounterSlot.Card.CreatureID, SearchType.Global);
                int           hP            = encounterSlot.Card.HP;
                int           damage        = hP - hoverToken.Data.Damage;
                int           num           = hP / 2;
                if (!mapView.ShowCreatureLabels)
                {
                    category = creature.Category;
                    if (category == "")
                    {
                        category = "Creature";
                    }
                }
                else
                {
                    category = hoverToken.Data.DisplayName;
                }
                if (hoverToken.Data.Damage == 0)
                {
                    str = "Not wounded";
                }
                if (damage < hP)
                {
                    str = "Wounded";
                }
                if (damage < num)
                {
                    str = "Bloodied";
                }
                if (damage <= 0)
                {
                    str = "Dead";
                }
                if (hoverToken.Data.Conditions.Count != 0)
                {
                    str = string.Concat(str, Environment.NewLine);
                    foreach (OngoingCondition condition in hoverToken.Data.Conditions)
                    {
                        str = string.Concat(str, Environment.NewLine);
                        str = string.Concat(str, condition.ToString(this.fParentMap.Encounter, false));
                    }
                }
            }
            if (mapView.HoverToken is Hero)
            {
                Hero hero = mapView.HoverToken as Hero;
                category = hero.Name;
                str      = string.Concat(hero.Race, " ", hero.Class);
                str      = string.Concat(str, Environment.NewLine);
                str      = string.Concat(str, "Player: ", hero.Player);
            }
            if (mapView.HoverToken is CustomToken)
            {
                CustomToken customToken = mapView.HoverToken as CustomToken;
                if (mapView.ShowCreatureLabels)
                {
                    category = customToken.Name;
                    str      = "(custom token)";
                }
            }
            this.Tooltip.ToolTipTitle = category;
            this.Tooltip.ToolTipIcon  = ToolTipIcon.Info;
            this.Tooltip.SetToolTip(mapView, str);
        }
 public SelectingState(Hero owner)
 {
     this.owner = owner;
 }
 void heroSlot_OnHeroRemoved(Hero hero)
 {
     heroOverview.gameObject.SetActive(false);
     heroOverview.ResetWindow();
     dragHeroLabel.enabled = true;
 }
Example #47
0
 public override float GetRemainingTime(Hero hero = null)
 {
     return(EndCast - Game.RawGameTime);
 }
Example #48
0
 void Awake()
 {
     S      = this;    //Set the Singleton
     bounds = Utils.CombineBoundsOfChildren(this.gameObject);
 }
Example #49
0
 public Illusion(Hero s)
 {
     Hero = s;
     OrbwalkingBehaviour = new CanUseOrbwalking();
     CooldownOnMoving    = 0.05f;
 }
Example #50
0
        private void OnUpdate()
        {
            var overwhelmingOdds = Main.OverwhelmingOdds;

            if (Menu.OverwhelmingOddsRadiusItem && overwhelmingOdds.Ability.Level > 0)
            {
                Particle.DrawRange(
                    Owner,
                    "OverwhelmingOddsRadius",
                    overwhelmingOdds.CastRange,
                    overwhelmingOdds.IsReady ? Color.Aqua : Color.Gray);
            }
            else
            {
                Particle.Remove("OverwhelmingOddsRadius");
            }

            var pressTheAttack = Main.PressTheAttack;

            if (Menu.PressTheAttackRadiusItem && pressTheAttack.Ability.Level > 0)
            {
                Particle.DrawRange(
                    Owner,
                    "PressTheAttackRadius",
                    pressTheAttack.CastRange,
                    pressTheAttack.IsReady ? Color.Aqua : Color.Gray);
            }
            else
            {
                Particle.Remove("PressTheAttackRadius");
            }

            var duel = Main.Duel;

            if (Menu.DuelRadiusItem && duel.Ability.Level > 0)
            {
                Particle.DrawRange(
                    Owner,
                    "DuelRadius",
                    duel.CastRange,
                    duel.IsReady ? Color.Aqua : Color.Gray);
            }
            else
            {
                Particle.Remove("DuelRadius");
            }

            var blink = Main.Blink;

            if (Menu.BlinkRadiusItem && blink != null)
            {
                Particle.DrawRange(
                    Owner,
                    "BlinkRadius",
                    blink.CastRange,
                    blink.IsReady ? Color.Aqua : Color.Gray);
            }
            else
            {
                Particle.Remove("BlinkRadius");
            }

            if (Menu.TargetItem.Value.SelectedValue.Contains("Lock") && TargetSelector.IsActive &&
                (!Menu.ComboKeyItem || Target == null || !Target.IsValid || !Target.IsAlive))
            {
                Target = TargetSelector.Active.GetTargets().FirstOrDefault() as Hero;
            }
            else if (Menu.TargetItem.Value.SelectedValue.Contains("Default") && TargetSelector.IsActive)
            {
                Target = TargetSelector.Active.GetTargets().FirstOrDefault() as Hero;
            }

            if (Target != null && (Menu.DrawOffTargetItem && !Menu.ComboKeyItem || Menu.DrawTargetItem && Menu.ComboKeyItem))
            {
                switch (Menu.TargetEffectTypeItem.Value.SelectedIndex)
                {
                case 0:
                    Particle.DrawTargetLine(
                        Owner,
                        "LegionCommanderPlusTarget",
                        Target.Position,
                        Menu.ComboKeyItem
                            ? new Color(Menu.TargetRedItem, Menu.TargetGreenItem, Menu.TargetBlueItem)
                            : new Color(Menu.OffTargetRedItem, Menu.OffTargetGreenItem, Menu.OffTargetBlueItem));
                    break;

                case 1:
                    Particle.DrawDangerLine(
                        Owner,
                        "LegionCommanderPlusTarget",
                        Target.Position,
                        Menu.ComboKeyItem
                            ? new Color(Menu.TargetRedItem, Menu.TargetGreenItem, Menu.TargetBlueItem)
                            : new Color(Menu.OffTargetRedItem, Menu.OffTargetGreenItem, Menu.OffTargetBlueItem));
                    break;

                default:
                    Particle.AddOrUpdate(
                        Target,
                        "LegionCommanderPlusTarget",
                        Menu.Effects[Menu.TargetEffectTypeItem.Value.SelectedIndex],
                        ParticleAttachment.AbsOriginFollow,
                        RestartType.NormalRestart,
                        1,
                        Menu.ComboKeyItem
                            ? new Color(Menu.TargetRedItem, Menu.TargetGreenItem, Menu.TargetBlueItem)
                            : new Color(Menu.OffTargetRedItem, Menu.OffTargetGreenItem, Menu.OffTargetBlueItem),
                        2,
                        new Vector3(255));
                    break;
                }
            }
            else
            {
                Particle.Remove("LegionCommanderPlusTarget");
            }
        }
Example #51
0
 private static void Prefix(Hero hero)
 {
     HeroCollection.DailyUpdate();
 }
 public MercenaryContractExpiredLogEntry(Hero mercenary)
 {
     _mercenary     = mercenary.CharacterObject;
     _hiringFaction = mercenary.MapFaction;
 }
 public void AddHero(Hero hero)
 {
     _heroes.Add(hero);
     DatabaseControl.getInstance().Set(_heroes);
 }
Example #54
0
 public void SetTarget(Hero newTarget)
 {
     CurrentTarget = newTarget;
 }
 // Whenever your health value is changed, inform the health bar
 public void OnHealthModified(Hero hero)
 {
     ui.OnHealthModified(hero);
 }
Example #56
0
        static void Main(string[] args)
        {
            Stopwatch sw = Stopwatch.StartNew();

            //Test in closure
            {
                string gameJson = "{       \"id\":\"s2xh3aig\",       \"turn\":1100,       \"maxTurns\":1200,       \"heroes\":[          {             \"id\":1,             \"name\":\"vjousse\",             \"userId\":\"j07ws669\",             \"elo\":1200,             \"pos\":{                \"x\":5,                \"y\":6             },             \"life\":60,             \"gold\":0,             \"mineCount\":0,             \"spawnPos\":{                \"x\":5,                \"y\":6             },             \"crashed\":true          },          {             \"id\":2,             \"name\":\"vjousse\",             \"userId\":\"j07ws669\",             \"elo\":1200,             \"pos\":{                \"x\":12,                \"y\":6             },             \"life\":100,             \"gold\":0,             \"mineCount\":0,             \"spawnPos\":{                \"x\":12,                \"y\":6             },             \"crashed\":true          },          {             \"id\":3,             \"name\":\"vjousse\",             \"userId\":\"j07ws669\",             \"elo\":1200,             \"pos\":{                \"x\":12,                \"y\":11             },             \"life\":80,             \"gold\":0,             \"mineCount\":0,             \"spawnPos\":{                \"x\":12,                \"y\":11             },             \"crashed\":true          },          {             \"id\":4,             \"name\":\"vjousse\",             \"userId\":\"j07ws669\",             \"elo\":1200,             \"pos\":{                \"x\":4,                \"y\":8             },             \"lastDir\": \"South\",             \"life\":38,             \"gold\":1078,             \"mineCount\":6,             \"spawnPos\":{                \"x\":5,                \"y\":11             },             \"crashed\":false          }       ],       \"board\":{          \"size\":18,          \"tiles\":\"##############        ############################        ##############################    ##############################$4    $4############################  @4    ########################  @1##    ##    ####################  []        []  ##################        ####        ####################  $4####$4  ########################  $4####$4  ####################        ####        ##################  []        []  ####################  @2##    ##@3  ########################        ############################$-    $-##############################    ##############################        ############################        ##############\"       },       \"finished\":true    }";
                string heroJson = " { 	\"id\":1, 	\"name\":\"vjousse\", 	\"userId\":\"j07ws669\", 	\"elo\":1200, 	\"pos\":{ 	   \"x\":5, 	   \"y\":6 	}, 	\"lastDir\": \"South\", 	\"life\":60, 	\"gold\":0, 	\"mineCount\":0, 	\"spawnPos\":{ 	   \"x\":5, 	   \"y\":6 	}, 	\"crashed\":true  }";
                Game   game     = Game.FromJson(gameJson);
                Hero   hero     = Hero.FromJson(heroJson);
            }

            string    gameStepJson = "{    \"game\":{       \"id\":\"s2xh3aig\",       \"turn\":1100,       \"maxTurns\":1200,       \"heroes\":[          {             \"id\":1,             \"name\":\"vjousse\",             \"userId\":\"j07ws669\",             \"elo\":1200,             \"pos\":{                \"x\":5,                \"y\":6             },             \"life\":60,             \"gold\":0,             \"mineCount\":0,             \"spawnPos\":{                \"x\":5,                \"y\":6             },             \"crashed\":true          },          {             \"id\":2,             \"name\":\"vjousse\",             \"userId\":\"j07ws669\",             \"elo\":1200,             \"pos\":{                \"x\":12,                \"y\":6             },             \"life\":100,             \"gold\":0,             \"mineCount\":0,             \"spawnPos\":{                \"x\":12,                \"y\":6             },             \"crashed\":true          },          {             \"id\":3,             \"name\":\"vjousse\",             \"userId\":\"j07ws669\",             \"elo\":1200,             \"pos\":{                \"x\":12,                \"y\":11             },             \"life\":80,             \"gold\":0,             \"mineCount\":0,             \"spawnPos\":{                \"x\":12,                \"y\":11             },             \"crashed\":true          },          {             \"id\":4,             \"name\":\"vjousse\",             \"userId\":\"j07ws669\",             \"elo\":1200,             \"pos\":{                \"x\":4,                \"y\":8             },             \"lastDir\": \"South\",             \"life\":38,             \"gold\":1078,             \"mineCount\":6,             \"spawnPos\":{                \"x\":5,                \"y\":11             },             \"crashed\":false          }       ],       \"board\":{          \"size\":18,          \"tiles\":\"##############        ############################        ##############################    ##############################$4    $4############################  @4    ########################  @1##    ##    ####################  []        []  ##################        ####        ####################  $4####$4  ########################  $4####$4  ####################        ####        ##################  []        []  ####################  @2##    ##@3  ########################        ############################$-    $-##############################    ##############################        ############################        ##############\"       },       \"finished\":true    },    \"hero\":{       \"id\":4,       \"name\":\"vjousse\",       \"userId\":\"j07ws669\",       \"elo\":1200,       \"pos\":{          \"x\":4,          \"y\":8       },       \"lastDir\": \"South\",       \"life\":38,       \"gold\":1078,       \"mineCount\":6,       \"spawnPos\":{          \"x\":5,          \"y\":11       },       \"crashed\":false    },    \"token\":\"lte0\",    \"viewUrl\":\"http://localhost:9000/s2xh3aig\",    \"playUrl\":\"http://localhost:9000/api/s2xh3aig/lte0/play\" }";
            GameState state        = GameState.FromJson(gameStepJson);

            Console.WriteLine(state.Game.Board.ToString());
            Console.WriteLine(string.Format("{0:#,0} ms", sw.ElapsedMilliseconds));

            Hero myHero    = state.Game.Heroes.First(x => x.ID == 1);
            Tile hero1Tile = state.Game.FindHeroes(x => x.OwnerId == 1).FirstOrDefault();
            Tile hero3Tile = state.Game.FindHeroes(x => x.OwnerId == 3).FirstOrDefault();

            IEnumerable <Tile> goldMines = state.Game.FindGoldMines(x => true);

            sw.Restart();
            PathFinder pathFinder = new PathFinder(state.Game.Board);

            var safeTravelFunc = new Func <Node, NodeStatus>(node => {
                Tile t        = node as Tile;
                var neighbors = state.Game.Board.GetNeighboringNodes(t, 1, true).Select(x => x as Tile);
                foreach (var x in neighbors)
                {
                    //Any heros in the area?
                    if (x.TileType == Tile.TileTypes.Hero &&
                        x.OwnerId != myHero.ID)
                    {
                        //Dangerous heros in the way?
                        Hero h = state.Game.LookupHero(x);
                        if (h != null)
                        {
                            //Avoid!
                            return(new NodeStatus(30, true));
                        }
                    }
                }
                return(new NodeStatus(1, false));
            });

            //Map all gold mines
            var pathsToGoldMines = state.Game.FindPathsToGoldMines(hero1Tile, x => true, safeTravelFunc).ToList();

            Console.WriteLine(string.Format("{0:#,0} ms", sw.ElapsedMilliseconds));

            foreach (var path in pathsToGoldMines)
            {
                sw.Restart();
                Console.WriteLine(state.Game.Board.ToString(path));
                Console.WriteLine(string.Format("{0:#,0} ms", sw.ElapsedMilliseconds));
            }

            sw.Restart();
            DirectionSet path2 = state.Game.FindPath(hero1Tile, hero3Tile);

            Console.WriteLine(string.Format("{0:#,0} ms", sw.ElapsedMilliseconds));
            Console.WriteLine(state.Game.Board.ToString(path2));

            Console.ReadLine();
        }
Example #57
0
 /// <summary>
 /// Adds resource amount to player
 /// </summary>
 /// <param name="h">Hero interacting with resource</param>
 /// <returns>returns true, true since resource is always picked up</returns>
 public override bool React(Hero h)
 {
     h.Player.Wallet.adjustResource(resourceID, amount);
     // Resource picked up, returned true
     return(true);
 }
 // When you die, inform the UI to spawn the continue countdown
 public void OnDead(Hero hero)
 {
     CurrentState = PlayerState.HeroDead;
     ui.OnDead(hero);
 }
Example #59
0
        public override bool CanBeCasted(EvadableAbility ability, Unit unit)
        {
            if (Hero.IsRuptured())
            {
                return(false);
            }

            blinkUnit =
                ObjectManager.GetEntitiesFast <Unit>()
                .FirstOrDefault(
                    x =>
                    x.IsValid && x.IsAlive && (x is Creep || x is Hero) && !x.Equals(Hero) && x.Team == HeroTeam &&
                    x.Distance2D(Hero) < GetCastRange() && x.Distance2D(Hero) > 200);

            return(!Sleeper.Sleeping && blinkUnit != null && Ability.CanBeCasted() && Hero.CanCast());
        }
Example #60
0
 public Player(Hero hero)
 {
     this.hero = hero;
 }