//constructor with overload public AbilityBase(AbilityEffect _abil_effect, AbilityTarget _abil_target, AbilityAOE _abil_aoe, int _str, int _duration, int _delay) { Ability_effect = _abil_effect; Ability_target = _abil_target; Ability_aoe = _abil_aoe; strength = _str; duration = _duration; delay = _delay; }
public UtilityItem(string id, string name, int tier, int uses, float weight, string type, float value, int range, AbilityEffect[] effects, AbilityAOE aoe, bool targetFriends = true, bool targetEnemies = false) : base(type) { this.id = id; this.name = name; this.tier = tier; hardness = uses; Uses = uses; this.weight = weight; this.initialValue = value; Ability = new UtilityItemAbility(this, id, name, range, false, effects, aoe, targetFriends, targetEnemies); }
//cost //used for generating a random ability public AbilityBase GenerateAbility(string seed) { AbilityBase ability = new AbilityBase(); //make sure that it is all uppercase seed = seed.ToLower(); //seeds consist of 7 letters //effect; damage, heal if (seed.Length > 0) { for (int ability_number = 0; ability_number < seed.Length; ability_number++) { //convert letter to int int integer = ConvertAlphabetToInteger(seed[ability_number].ToString()); //loop for going through the alphabet for (int number = 0; number < 27; number++) { if (integer == number) { switch (ability_number) { case 0: //ability effect Ability_effect = (AbilityEffect)number; break; case 1: //ability target Ability_target = (AbilityTarget)number; break; case 2: //ability aoe Ability_aoe = (AbilityAOE)number; break; case 3: //strength strength = number; break; case 4: //duration duration = number; break; case 5: //delay delay = number; break; } //break out of loop break; } } } ability = new AbilityBase( Ability_effect, Ability_target, Ability_aoe, strength, duration, delay ); /* Debug.Log( * "Effect: " + ability.Ability_effect + "\n" + * "Target: " + ability.Ability_target + "\n" + * "AoE: " + ability.Ability_aoe + "\n" + * "Strength: " + ability.strength + "\n" + * "Duration: " + ability.duration + "\n" + * "Delay: " + ability.delay * ); */ } return(ability); }
public UtilityItemAbility(UtilityItem item, string id, string name, int range, bool ignoreLineOfSight, AbilityEffect[] effects, AbilityAOE areaOfEffect, bool targetFriends = true, bool targetEnemies = false) : base(id, name, 0, range, ignoreLineOfSight, effects, areaOfEffect, targetFriends, targetEnemies) { this.item = item; }