Beispiel #1
0
        public static Missile Create(MissileInfo missileInfo, Vector3 start, Vector3 target, Character originator)
        {
            var gameObject = new GameObject("missile_" + missileInfo.missile);
            var missile    = gameObject.AddComponent <Missile>();

            missile.animator = gameObject.AddComponent <SpriteAnimator>();
            missile.renderer = gameObject.GetComponent <SpriteRenderer>();
            missile.iso      = gameObject.AddComponent <Iso>();

            missile.info              = missileInfo;
            missile.originator        = originator;
            missile.speed             = missileInfo.velocity;
            missile.iso.pos           = start;
            missile.dir               = (target - start).normalized;
            missile.renderer.material = missileInfo.material;
            missile.skillInfo         = SkillInfo.Find(missileInfo.skill);
            missile.lifeTime          = 0;

            var spritesheet = Spritesheet.Load(missileInfo.spritesheetFilename);
            int direction   = Iso.Direction(start, target, spritesheet.directionCount);

            missile.animator.sprites = spritesheet.GetSprites(direction);
            missile.animator.loop    = missileInfo.loopAnim != 0;
            missile.animator.fps     = missileInfo.fps;

            AudioManager.instance.Play(missileInfo.travelSound, missile.transform);

            return(missile);
        }
Beispiel #2
0
        void Start()
        {
            SkillPanel.instance.OnClick += index =>
            {
                selectingSkillIndex = index;
                AvailableSkillsPanel.instance.Toggle();
            };
            AvailableSkillsPanel.instance.OnSkillSelected += skillInfo =>
            {
                SetHotSkill(selectingSkillIndex, skillInfo);
            };
            for (int i = 0; i < hotSkills.Count; ++i)
            {
                SkillPanel.instance.SetHotKey(i, hotSkillsBindings[i].ToString());
            }

            foreach (var skillInfo in availableSkills)
            {
                AvailableSkillsPanel.instance.AddSkill(skillInfo);
            }
            AvailableSkillsPanel.instance.Hide();  // TODO This line affects newly added skills with AddSkill, fix it

            SetHotSkill(0, SkillInfo.Find("Fire Bolt"));
            SetHotSkill(1, SkillInfo.Find("Raise Skeleton"));
            SetHotSkill(2, SkillInfo.Find("Frost Nova"));
            SetHotSkill(3, SkillInfo.Find("Teleport"));
            SetHotSkill(4, SkillInfo.Find("Nova"));
            SetHotSkill(5, SkillInfo.Find("Frozen Orb"));
        }
        void Awake()
        {
            instance = this;

            if (character == null)
            {
                var player = GameObject.FindWithTag("Player");
                if (player != null)
                {
                    SetCharacter(player.GetComponent <Character>());
                }
            }

            hotSkills = new List <SkillInfo>();
            hotSkills.AddRange(Enumerable.Repeat((SkillInfo)null, 6));
            availableSkills = new List <SkillInfo> {
                // Sorceress
                SkillInfo.Find("Fire Bolt"),
                SkillInfo.Find("Charged Bolt"),
                SkillInfo.Find("Frost Nova"),
                SkillInfo.Find("Teleport"),
                SkillInfo.Find("Nova"),
                SkillInfo.Find("Frozen Orb"),
                SkillInfo.Find("Poison Nova"),
                SkillInfo.Find("Glacial Spike"),
                SkillInfo.Find("Ice Bolt"),
                SkillInfo.Find("Ice Blast"),
                SkillInfo.Find("Fire Ball"),
                // Barbarian
                SkillInfo.Find("Shout"),
                SkillInfo.Find("Battle Cry"),
                SkillInfo.Find("Battle Orders"),
                SkillInfo.Find("Battle Command"),
                SkillInfo.Find("War Cry"),
                // Necromancer
                SkillInfo.Find("Raise Skeleton"),
                SkillInfo.Find("Raise Skeletal Mage"),
                SkillInfo.Find("Clay Golem"),
                SkillInfo.Find("IronGolem"),
                SkillInfo.Find("FireGolem"),
                SkillInfo.Find("BloodGolem"),
                // Druid
                SkillInfo.Find("Raven"),
                SkillInfo.Find("Summon Spirit Wolf"),
                SkillInfo.Find("Summon Fenris"),
                SkillInfo.Find("Summon Grizzly"),
                SkillInfo.Find("Oak Sage"),
                SkillInfo.Find("Heart of Wolverine"),
                SkillInfo.Find("Spirit of Barbs"),
                // Assassin
                SkillInfo.Find("Charged Bolt Sentry"),
                SkillInfo.Find("Wake of Fire Sentry"),
                SkillInfo.Find("Lightning Sentry"),
                SkillInfo.Find("Inferno Sentry"),
                SkillInfo.Find("Death Sentry"),
            };

            leftSkill  = SkillInfo.Attack;
            rightSkill = SkillInfo.Attack;
        }
Beispiel #4
0
        void Awake()
        {
            instance = this;

            // todo: Maybe add customized palette
            palette = Palette.GetPalette(PaletteType.Act1);

            hotSkills = new List <SkillInfo>();
            hotSkills.AddRange(Enumerable.Repeat((SkillInfo)null, 6));
            availableSkills = new List <SkillInfo> {
                // Sorceress
                SkillInfo.Find("Fire Bolt"),
                SkillInfo.Find("Charged Bolt"),
                SkillInfo.Find("Frost Nova"),
                SkillInfo.Find("Teleport"),
                SkillInfo.Find("Nova"),
                SkillInfo.Find("Frozen Orb"),
                SkillInfo.Find("Poison Nova"),
                SkillInfo.Find("Glacial Spike"),
                SkillInfo.Find("Ice Bolt"),
                SkillInfo.Find("Ice Blast"),
                SkillInfo.Find("Fire Ball"),
                // Barbarian
                SkillInfo.Find("Shout"),
                SkillInfo.Find("Battle Cry"),
                SkillInfo.Find("Battle Orders"),
                SkillInfo.Find("Battle Command"),
                SkillInfo.Find("War Cry"),
                // Necromancer
                SkillInfo.Find("Raise Skeleton"),
                SkillInfo.Find("Raise Skeletal Mage"),
                SkillInfo.Find("Clay Golem"),
                SkillInfo.Find("IronGolem"),
                SkillInfo.Find("FireGolem"),
                SkillInfo.Find("BloodGolem"),
                // Druid
                SkillInfo.Find("Raven"),
                SkillInfo.Find("Summon Spirit Wolf"),
                SkillInfo.Find("Summon Fenris"),
                SkillInfo.Find("Summon Grizzly"),
                SkillInfo.Find("Oak Sage"),
                SkillInfo.Find("Heart of Wolverine"),
                SkillInfo.Find("Spirit of Barbs"),
                // Assassin
                SkillInfo.Find("Charged Bolt Sentry"),
                SkillInfo.Find("Wake of Fire Sentry"),
                SkillInfo.Find("Lightning Sentry"),
                SkillInfo.Find("Inferno Sentry"),
                SkillInfo.Find("Death Sentry"),
            };

            leftSkill  = SkillInfo.Attack;
            rightSkill = SkillInfo.Attack;
        }
Beispiel #5
0
    void Awake()
    {
        instance = this;

        if (character == null)
        {
            var player = GameObject.FindWithTag("Player");
            if (player != null)
            {
                SetCharacter(player.GetComponent <Character>());
            }
        }

        hotSkills = new List <SkillInfo> {
            SkillInfo.Find("Fire Bolt"),
            SkillInfo.Find("Charged Bolt"),
            SkillInfo.Find("Glacial Spike"),
            SkillInfo.Find("Teleport"),
            null,
            null,
        };
    }
Beispiel #6
0
    void Awake()
    {
        instance = this;

        if (character == null)
        {
            var player = GameObject.FindWithTag("Player");
            if (player != null)
            {
                SetCharacter(player.GetComponent <Character>());
            }
        }

        skillMap = new Dictionary <KeyCode, SkillInfo> {
            { KeyCode.F1, SkillInfo.Find("Fire Bolt") },
            { KeyCode.F2, SkillInfo.Find("Charged Bolt") },
            { KeyCode.F3, SkillInfo.Find("Ice Bolt") },
            { KeyCode.F4, SkillInfo.Find("Teleport") },
            { KeyCode.F5, SkillInfo.Find("Glacial Spike") },
            { KeyCode.F6, SkillInfo.Find("Guided Arrow") }
        };
    }
Beispiel #7
0
        private void DescribeProperty(StringBuilder sb, Property prop)
        {
            foreach (var block in prop.info.blocks)
            {
                int value = prop.value;

                if (block.func == 5)
                {
                    sb.Append("\n");
                    sb.Append("+");
                    sb.Append(value);
                    sb.Append(" To Minimum Damage");
                    continue;
                }
                else if (block.func == 6)
                {
                    sb.Append("\n");
                    sb.Append("+");
                    sb.Append(value);
                    sb.Append(" To Maximum Damage");
                    continue;
                }
                else if (block.func == 7)
                {
                    sb.Append("\n");
                    sb.Append("+");
                    sb.Append(value);
                    sb.Append("% Enhanced Damage");
                    continue;
                }
                else if (block.func == 14)
                {
                    sb.Append("\nSocketed (");
                    sb.Append(prop.value);
                    sb.Append(")");
                }
                else if (block.func == 17)
                {
                    int characterLevel = 10;
                    int perLevel       = prop.param != null?int.Parse(prop.param) : 1;

                    value = perLevel * characterLevel;
                }
                if (block.stat == null)
                {
                    continue;
                }

                string sign = value > 0 ? "+" : "";
                string str1 = value > 0 ? block.stat.descPositive : block.stat.descNegative;
                sb.Append("\n");
                if (block.stat.descFunc == 1 || block.stat.descFunc == 12)
                {
                    if (block.stat.descVal == 1)
                    {
                        sb.Append(sign);
                        sb.Append(value);
                        sb.Append(" ");
                    }
                    sb.Append(str1);
                    if (block.stat.descVal == 2)
                    {
                        sb.Append(" ");
                        sb.Append(sign);
                        sb.Append(value);
                    }
                }
                else if (block.stat.descFunc == 2)
                {
                    if (block.stat.descVal == 1)
                    {
                        sb.Append(value);
                        sb.Append("% ");
                    }
                    sb.Append(str1);
                    if (block.stat.descVal == 2)
                    {
                        sb.Append(" ");
                        sb.Append(value);
                        sb.Append("%");
                    }
                }
                else if (block.stat.descFunc == 3)
                {
                    if (block.stat.descVal == 1)
                    {
                        sb.Append(value);
                        sb.Append(" ");
                    }
                    sb.Append(str1);
                    if (block.stat.descVal == 2)
                    {
                        sb.Append(" ");
                        sb.Append(value);
                    }
                }
                else if (block.stat.descFunc == 4)
                {
                    if (block.stat.descVal == 1)
                    {
                        sb.Append(sign);
                        sb.Append(value);
                        sb.Append("% ");
                    }
                    sb.Append(str1);
                    if (block.stat.descVal == 2)
                    {
                        sb.Append(" ");
                        sb.Append(sign);
                        sb.Append(value);
                        sb.Append("%");
                    }
                }
                else if (block.stat.descFunc == 5)
                {
                    sb.Append(value * 100 / 128);
                    sb.Append("% ");
                    sb.Append(str1);
                }
                else if (block.stat.descFunc == 6)
                {
                    sb.Append(sign);
                    sb.Append(value);
                    sb.Append(" ");
                    sb.Append(str1);
                    sb.Append(" ");
                    sb.Append(block.stat.desc2);
                }
                else if (block.stat.descFunc == 7)
                {
                    sb.Append(value);
                    sb.Append("% ");
                    sb.Append(str1);
                    sb.Append(" ");
                    sb.Append(block.stat.desc2);
                }
                else if (block.stat.descFunc == 8)
                {
                    sb.Append(sign);
                    sb.Append(value);
                    sb.Append("% ");
                    sb.Append(str1);
                    sb.Append(" ");
                    sb.Append(block.stat.desc2);
                }
                else if (block.stat.descFunc == 9)
                {
                    sb.Append(value);
                    sb.Append(" ");
                    sb.Append(str1);
                    sb.Append(" ");
                    sb.Append(block.stat.desc2);
                }
                else if (block.stat.descFunc == 10)
                {
                    sb.Append(value * 100 / 128);
                    sb.Append("% ");
                    sb.Append(str1);
                    sb.Append(" ");
                    sb.Append(block.stat.desc2);
                }
                else if (block.stat.descFunc == 11)
                {
                    sb.Append("Repairs 1 Durability In ");
                    sb.Append(100 / value);
                    sb.Append(" Seconds");
                }
                else if (block.stat.descFunc == 13)
                {
                    sb.Append("+");
                    sb.Append(value);
                    sb.Append(" to ");
                    string className = CharStatsInfo.sheet[block.value].className;
                    sb.Append(className);
                    sb.Append(" Skill Levels");
                }
                else if (block.stat.descFunc == 14)
                {
                    string skillTabId = prop.param;
                    var    charStat   = CharStatsInfo.FindByCode(prop.classSpecific);
                    string className  = charStat != null ? charStat.className : "NULL";
                    sb.Append(sign);
                    sb.Append(value);
                    sb.Append(" to ");
                    sb.Append("skilltab" + skillTabId);
                    sb.Append(" Skill Levels (");
                    sb.Append(className);
                    sb.Append(" Only)");
                }
                else if (block.stat.descFunc == 15)
                {
                    string skillId    = prop.param;
                    var    skillInfo  = SkillInfo.Find(skillId);
                    int    chance     = prop.min;
                    int    skillLevel = prop.max;
                    sb.Append(chance);
                    sb.Append("% to cast Level ");
                    sb.Append(skillLevel);
                    sb.Append(" ");
                    sb.Append(skillInfo.name);
                    sb.Append(" on ");
                    sb.Append(block.stat.itemEvent1);
                }
                else if (block.stat.descFunc == 16)
                {
                    sb.Append("Level [sLvl] [skill] Aura When Equipped");
                }
                else if (block.stat.descFunc == 17)
                {
                    sb.Append("[value] [string1] (Increases near [time]) ");
                }
                else if (block.stat.descFunc == 18)
                {
                    sb.Append("[value]% [string1] (Increases near [time])");
                }
                else if (block.stat.descFunc == 19)
                {
                    sb.Append("sprintf");
                }
                else if (block.stat.descFunc == 20)
                {
                    sb.Append(-value);
                    sb.Append("% ");
                    sb.Append(str1);
                }
                else if (block.stat.descFunc == 21)
                {
                    sb.Append(-value);
                    sb.Append(" ");
                    sb.Append(str1);
                }
                else if (block.stat.descFunc == 22)
                {
                    sb.Append("[value]% [string1] [montype]");
                }
                else if (block.stat.descFunc == 23)
                {
                    sb.Append("[value]% [string1] [monster]");
                }
                else if (block.stat.descFunc == 24)
                {
                    int    chargeCount = -prop.min;
                    int    skillLevel  = -prop.max;
                    string skillId     = prop.param;
                    var    skillInfo   = SkillInfo.Find(skillId);
                    sb.Append("Level ");
                    sb.Append(skillLevel);
                    sb.Append(" ");
                    sb.Append(skillInfo.name);
                    sb.Append(" (");
                    sb.Append(chargeCount);
                    sb.Append("/");
                    sb.Append(chargeCount);
                    sb.Append(" Charges)");
                }
                else if (block.stat.descFunc == 27)
                {
                    string skillId   = prop.param;
                    var    skillInfo = SkillInfo.Find(skillId);
                    var    className = CharStatsInfo.FindByCode(skillInfo.charClass).className;
                    sb.Append("+");
                    sb.Append(value);
                    sb.Append(" to ");
                    sb.Append(skillInfo.name);
                    sb.Append(" (");
                    sb.Append(className);
                    sb.Append(" Only)");
                }
                else if (block.stat.descFunc == 28)
                {
                    string skillId   = prop.param;
                    var    skillInfo = SkillInfo.Find(skillId);
                    sb.Append("+");
                    sb.Append(value);
                    sb.Append(" to ");
                    sb.Append(skillInfo.name);
                }
                else
                {
                    AppendColored(sb, block.statId + "(descFunc " + block.stat.descFunc + ")" + ": " + str1, Colors.ItemLowQualityHex);
                }
            }
        }