Skip to content
This repository has been archived by the owner on Oct 22, 2019. It is now read-only.

Abilities/Stats should not use HeroId/Name #34

Closed
Akkuma opened this issue May 11, 2016 · 6 comments
Closed

Abilities/Stats should not use HeroId/Name #34

Akkuma opened this issue May 11, 2016 · 6 comments
Labels

Comments

@Akkuma
Copy link

Akkuma commented May 11, 2016

It is fairly redundant to have a hero object that has at the top level id and then within stats/abilities have the heroId/Name as the only key off of them to then access the real data.

It should look like this:

 "stats": {
      "hp": 700,
      "hpPerLevel": 110,
      "hpRegen": 1.457,
      "hpRegenPerLevel": 0.2265,
      "mana": 500,
      "manaPerLevel": 10,
      "manaRegen": 3,
      "manaRegenPerLevel": 0.0976
  },
  "abilities": [
      {
        "id": "NovaSnipeStorm",
        "icon": "storm_ui_icon_nova_snipe.dds",
        "manaCost": 65,
        "name": "Snipe",
        "description": "Deals 115 (+31 per level) damage to the first enemy hit.",
        "cooldown": 10,
        "aimType": "Skillshot",
        "shortcut": "Q"
      },
      {
        "id": "NovaPinningShot",
        "icon": "storm_ui_icon_Nova_PinningShot.dds",
        "manaCost": 65,
        "name": "Pinning Shot",
        "description": "Deal 40 (+10 per level) damage to an enemy and slow it by 30% for 2.25 seconds.",
        "cooldown": 12,
        "shortcut": "W"
      },
      {
        "id": "NovaHoloDecoy",
        "icon": "storm_ui_icon_nova_holodecoy.dds",
        "manaCost": 50,
        "name": "Holo Decoy",
        "description": "Create a Decoy for 5 seconds that appears to attack enemies. \nUsing this Ability does not break Cloak.",
        "cooldown": 15,
        "shortcut": "E"
      },
      {
        "id": "NovaTripleTap",
        "icon": "storm_ui_icon_nova_tripletap.dds",
        "manaCost": 100,
        "heroic": true,
        "name": "Triple Tap",
        "description": "Locks in on the target Hero, then fires 3 shots that hit the first Hero or Structure they come in contact with for 80 (+33 per level) damage each.",
        "cooldown": 100,
        "shortcut": "R"
      },
      {
        "id": "NovaPrecisionStrike",
        "icon": "storm_ui_icon_nova_orbitalstrike.dds",
        "manaCost": 100,
        "heroic": true,
        "name": "Precision Strike",
        "description": "After a 1.5 second delay, deals 300 (+35 per level) damage to enemies within an area. Unlimited range.",
        "cooldown": 60,
        "shortcut": "R"
      },
      {
        "id": "NovaPermanentCloakSniper",
        "trait": true,
        "icon": "storm_ui_icon_nova_personalcloaking.dds",
        "name": "Permanent Cloak, Sniper",
        "description": "Gain Stealth when out of combat for 3 seconds. Taking damage, attacking, or channeling reveals you.\nBasic Attack range is 20% further than other ranged Heroes, and you see 10% further than other Heroes."
      }
    ]
@jnovack
Copy link
Member

jnovack commented May 11, 2016

That's true for single heros, but what about heroes with a different set of abilities for each form?

  • Greymane vs Worgen
  • Chen's Earth, Storm, and Fire
  • Tychus Odin

@jnovack jnovack closed this as completed May 11, 2016
@Akkuma
Copy link
Author

Akkuma commented May 11, 2016

That is simply to solve. You put the applicable field into applicable abilities, so you add a form into each ability. ie:

{
        "id": "NovaPermanentCloakSniper",
        "form": "Worgen",
        "trait": true,
        "icon": "storm_ui_icon_nova_personalcloaking.dds",
        "name": "Permanent Cloak, Sniper",
        "description": "Gain Stealth when out of combat for 3 seconds. Taking damage, attacking, or channeling reveals you.\nBasic Attack range is 20% further than other ranged Heroes, and you see 10% further than other Heroes."
      }

@jnovack
Copy link
Member

jnovack commented May 11, 2016

Since abilities are child elements of heroes (or "forms" as this discussing is calling them), it follows a logical progression in object-orientated languages.

@Akkuma
Copy link
Author

Akkuma commented May 11, 2016

I don't quite understand what you wrote, but I could just be tired. Are you saying something like heroes/forms have abilities, thus Greymane has an array of abilities and Worgen has an array of abilities, since they are two different forms? A Hero Object has Abilities, which can have many Forms, which has many FormAbility in the current version. I'm arguing that a Hero Object can look like has many Ability and an Ability has a Form, which is in this case just a string.

In pseudocode

class Hero
  Abilities abilities

class Abilities
  Forms[] forms

class Form
  FormAbility[] abilities

vs

class Hero
  Ability[] abilities

class Ability
 String form

@jnovack
Copy link
Member

jnovack commented May 11, 2016

An Ability belongs to a Form of a Hero.

HeroName {
  Abilities [
    Form [
      Ability
    ]
  ]
}

So, to access Greymane's Worgen abilities, .['GreyMane'].Abilities['Worgen'] should yield you an array of objects.

@Akkuma
Copy link
Author

Akkuma commented May 11, 2016

I already wrote that above. My point is that you can simplify the tree and it still makes perfect sense from OOP. If you must have Forms as a true object then the tree could look like.

Hero
  Forms [
    Form {
      Abilities [ Ability ]
      Stats { }
    }
  ]

To access Greymane's Worgen it would be Hero.Forms['Worgen].Abilities or with my first solution Hero.Abilities.Filter(ability => ability.form == 'Worgen') for the handful of heroes who actually have a form, while everyone else is simply Hero.Abilities

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants