public static BaseTrait createSpikes()
    {
        string traitString = Traits.Spikes.ToString();

        if (instantiatedTraits.ContainsKey(traitString))
        {
            return(instantiatedTraits[traitString]);
        }
        BaseTrait spikes = new BaseTrait();

        spikes.attributes.Add(Attribute.Fighting.ToString(), 4);
        spikes.attributes.Add(Attribute.Strength.ToString(), 1);
        spikes.attributes.Add(Attribute.Tracking.ToString(), 0);
        spikes.attributes.Add(Attribute.Food.ToString(), 0);

//        spikes.inheritanceChance = 0.1f;

        spikes.name       = traitString;
        spikes.type       = traitString;
        spikes.traitClass = null;

        spikes.linkageMap.Add(Traits.Strong.ToString(), 2.0f);
        spikes.linkageMap.Add(Traits.Quick.ToString(), -1.0f);
        spikes.linkageMap.Add(Traits.Aggressive.ToString(), 1.0f);

        instantiatedTraits[traitString] = spikes;
        return(spikes);
    }
    public static BaseTrait createFat()
    {
        string traitString = Traits.Fat.ToString();

        if (instantiatedTraits.ContainsKey(traitString))
        {
            return(instantiatedTraits[traitString]);
        }
        BaseTrait fat = new BaseTrait();

        fat.attributes.Add(Attribute.Fighting.ToString(), -2);
        fat.attributes.Add(Attribute.Strength.ToString(), -1);
        fat.attributes.Add(Attribute.Tracking.ToString(), -1);
        fat.attributes.Add(Attribute.Food.ToString(), 3);

        //        fat.inheritanceChance = 0.1f;

        fat.name       = traitString;
        fat.type       = traitString;
        fat.traitClass = null;

        fat.linkageMap.Add(Traits.Delicious.ToString(), 2.0f);
        fat.linkageMap.Add(Traits.Marbled.ToString(), 2.0f);


        instantiatedTraits[traitString] = fat;
        return(fat);
    }
    public static BaseTrait createHorned()
    {
        string traitString = Traits.Horned.ToString();

        if (instantiatedTraits.ContainsKey(traitString))
        {
            return(instantiatedTraits[traitString]);
        }
        BaseTrait horned = new BaseTrait();

        horned.attributes.Add(Attribute.Fighting.ToString(), 3);
        horned.attributes.Add(Attribute.Strength.ToString(), 1);
//        horned.attributes.Add(Attribute.Tracking.ToString(), 0);
//        horned.attributes.Add(Attribute.Food.ToString(), 0);
//
//        horned.inheritanceChance = 0.1f;

        horned.name       = traitString;
        horned.type       = traitString;
        horned.traitClass = null;

        horned.linkageMap.Add(Traits.Armored.ToString(), 1.0f);
        horned.linkageMap.Add(Traits.Aggressive.ToString(), 1.0f);

        instantiatedTraits[traitString] = horned;
        return(horned);
    }
    public static BaseTrait createKeenEyes()
    {
        string traitString = Traits.KeenEyes.ToString();

        if (instantiatedTraits.ContainsKey(traitString))
        {
            return(instantiatedTraits[traitString]);
        }
        BaseTrait keenEyes = new BaseTrait();

        keenEyes.attributes.Add(Attribute.Fighting.ToString(), 1);
        keenEyes.attributes.Add(Attribute.Strength.ToString(), 0);
        keenEyes.attributes.Add(Attribute.Tracking.ToString(), 4);
        keenEyes.attributes.Add(Attribute.Food.ToString(), 0);

//        keenEyes.inheritanceChance = 0.1f;

        keenEyes.name       = traitString;
        keenEyes.type       = traitString;
        keenEyes.traitClass = null;

        keenEyes.linkageMap.Add(Traits.Flying.ToString(), 1.0f);

        instantiatedTraits[traitString] = keenEyes;
        return(keenEyes);
    }
    public static BaseTrait createArmored()
    {
        string traitString = Traits.Armored.ToString();

        if (instantiatedTraits.ContainsKey(traitString))
        {
            return(instantiatedTraits[traitString]);
        }
        BaseTrait armored = new BaseTrait();

        armored.attributes.Add(Attribute.Fighting.ToString(), 4);
        armored.attributes.Add(Attribute.Strength.ToString(), 1);
        armored.attributes.Add(Attribute.Tracking.ToString(), 0);
        armored.attributes.Add(Attribute.Food.ToString(), 0);

//        armored.inheritanceChance = 0.1f;

        armored.name       = traitString;
        armored.type       = traitString;
        armored.traitClass = null;

        armored.linkageMap.Add(Traits.Strong.ToString(), 4.0f);
        armored.linkageMap.Add(Traits.Quick.ToString(), -2.0f);

        instantiatedTraits[traitString] = armored;
        return(armored);
    }
    public static BaseTrait createDocile()
    {
        string traitString = Traits.Docile.ToString();

        if (instantiatedTraits.ContainsKey(traitString))
        {
            return(instantiatedTraits[traitString]);
        }
        BaseTrait docile = new BaseTrait();

        docile.attributes.Add(Attribute.Fighting.ToString(), -2);
        docile.attributes.Add(Attribute.Strength.ToString(), 0);
        docile.attributes.Add(Attribute.Tracking.ToString(), -2);
        docile.attributes.Add(Attribute.Food.ToString(), 0);

//        docile.inheritanceChance = 0.1f;

        docile.name       = traitString;
        docile.type       = traitString;
        docile.traitClass = TraitClass.Aggression.ToString();

        docile.linkageMap.Add(Traits.Independent.ToString(), -2.0f);

        instantiatedTraits[traitString] = docile;
        return(docile);
    }
    public static BaseTrait createFlying()
    {
        string traitString = Traits.Flying.ToString();

        if (instantiatedTraits.ContainsKey(traitString))
        {
            return(instantiatedTraits[traitString]);
        }
        BaseTrait flying = new BaseTrait();

        flying.attributes.Add(Attribute.Fighting.ToString(), 1);
        flying.attributes.Add(Attribute.Strength.ToString(), 0);
        flying.attributes.Add(Attribute.Tracking.ToString(), 2);
        flying.attributes.Add(Attribute.Food.ToString(), 0);

        flying.inheritanceChance = -2.0f;

        flying.name       = traitString;
        flying.type       = traitString;
        flying.traitClass = null;

        flying.linkageMap.Add(Traits.Quick.ToString(), 2.0f);
        flying.linkageMap.Add(Traits.KeenEyes.ToString(), 1.0f);

        instantiatedTraits[traitString] = flying;
        return(flying);
    }
    public static BaseTrait createAggressive()
    {
        if (instantiatedTraits.ContainsKey(Traits.Aggressive.ToString()))
        {
            return(instantiatedTraits[Traits.Aggressive.ToString()]);
        }
        BaseTrait aggressive = new BaseTrait();

        aggressive.attributes.Add(Attribute.Fighting.ToString(), 2);
        aggressive.attributes.Add(Attribute.Strength.ToString(), 0);
        aggressive.attributes.Add(Attribute.Tracking.ToString(), 1);
        aggressive.attributes.Add(Attribute.Food.ToString(), 0);

//        aggressive.inheritanceChance = 0.1f;

        aggressive.name       = Traits.Aggressive.ToString();
        aggressive.type       = Traits.Aggressive.ToString();
        aggressive.traitClass = TraitClass.Aggression.ToString();

        aggressive.linkageMap.Add(Traits.Independent.ToString(), 1.0f);
        aggressive.linkageMap.Add(Traits.Loyal.ToString(), -2.0f);

        instantiatedTraits[Traits.Aggressive.ToString()] = aggressive;
        return(aggressive);
    }
    public static BaseTrait createLoyal()
    {
        string traitString = Traits.Loyal.ToString();

        if (instantiatedTraits.ContainsKey(traitString))
        {
            return(instantiatedTraits[traitString]);
        }
        BaseTrait loyalty = new BaseTrait();

        loyalty.attributes.Add(Attribute.Fighting.ToString(), 1);
        loyalty.attributes.Add(Attribute.Strength.ToString(), 0);
        loyalty.attributes.Add(Attribute.Tracking.ToString(), 1);
        loyalty.attributes.Add(Attribute.Food.ToString(), 0);

//        loyalty.inheritanceChance = 0.1f;

        loyalty.name       = traitString;
        loyalty.type       = traitString;
        loyalty.traitClass = TraitClass.Loyalty.ToString();

        loyalty.linkageMap.Add(Traits.Docile.ToString(), 1.0f);
        loyalty.linkageMap.Add(Traits.Aggressive.ToString(), -1.0f);

        instantiatedTraits[traitString] = loyalty;
        return(loyalty);
    }
    public static BaseTrait createIndependent()
    {
        string traitString = Traits.Independent.ToString();

        if (instantiatedTraits.ContainsKey(traitString))
        {
            return(instantiatedTraits[traitString]);
        }
        BaseTrait independent = new BaseTrait();

        independent.attributes.Add(Attribute.Fighting.ToString(), 2);
        independent.attributes.Add(Attribute.Strength.ToString(), 0);
        independent.attributes.Add(Attribute.Tracking.ToString(), 0);
        independent.attributes.Add(Attribute.Food.ToString(), 0);

//        independent.inheritanceChance = 0.1f;

        independent.name       = traitString;
        independent.type       = traitString;
        independent.traitClass = null;

        independent.linkageMap.Add(Traits.Docile.ToString(), -2.0f);
        independent.linkageMap.Add(Traits.Aggressive.ToString(), 2.0f);

        instantiatedTraits[traitString] = independent;
        return(independent);
    }
    public static BaseTrait createMarbled()
    {
        string traitString = Traits.Marbled.ToString();

        if (instantiatedTraits.ContainsKey(traitString))
        {
            return(instantiatedTraits[traitString]);
        }
        BaseTrait marbled = new BaseTrait();

        marbled.attributes.Add(Attribute.Fighting.ToString(), 0);
        marbled.attributes.Add(Attribute.Strength.ToString(), 0);
        marbled.attributes.Add(Attribute.Tracking.ToString(), 0);
        marbled.attributes.Add(Attribute.Food.ToString(), 3);

        //        marbled.inheritanceChance = 0.1f;

        marbled.name       = traitString;
        marbled.type       = traitString;
        marbled.traitClass = null;

        marbled.linkageMap.Add(Traits.Delicious.ToString(), 2.0f);
        marbled.linkageMap.Add(Traits.Fat.ToString(), 2.0f);

        instantiatedTraits[traitString] = marbled;
        return(marbled);
    }
    void GenerateTraits()
    {
        //Generate Traits
        for (int i = 0; i < StartingAmountOfTraits; i++)
        {
            BaseTrait _tempTrait = TraitManager.GetRandomTrait();

            //Check if trait already added if so make the for look go once more to compencate
            if (!Traits.Contains(_tempTrait))
            {
                Traits.Add(_tempTrait);
                int[] _TraitEffects = _tempTrait.GetTraitEffectedStats();
                for (int j = 0; j < _TraitEffects.Length; j++)
                {
                    Debug.Log(_TraitEffects[j]);
                    if (_TraitEffects[j] != 0) //reson this is 0 is to see if value has been changed
                    {
                        if (j == 0)
                        {
                            PlayerOpinion += _TraitEffects[j];
                        }
                        else if (j == 1)
                        {
                            Strength += _TraitEffects[j];
                        }
                        else if (j == 2)
                        {
                            Agility += _TraitEffects[j];
                        }
                        else if (j == 3)
                        {
                            Inteligence += _TraitEffects[j];
                        }
                        else if (j == 4)
                        {
                            Charisma += _TraitEffects[j];
                        }
                        else if (j == 5)
                        {
                            Cunning += _TraitEffects[j];
                        }
                    }
                }
            }
            else
            {
                i--;
                Debug.Log("Trait already Added, Generating a new one");
            }
        }
    }
Beispiel #13
0
    public static float numKeenEyes(WorldState ws)
    {
        BaseTrait trait = TraitFactory.createKeenEyes();

        float c = 0;

        foreach (GameObject partyMember in ws.GetParty().GetMembers())
        {
            Animal animal = partyMember.GetComponent <Animal> ();
            if (animal != null)
            {
                if (animal.Traits.Contains(trait))
                {
                    c++;
                }
            }
        }
        return(c);
    }
    public static BaseTrait createStealthy()
    {
        string traitString = Traits.Stealthy.ToString();

        if (instantiatedTraits.ContainsKey(traitString))
        {
            return(instantiatedTraits[traitString]);
        }
        BaseTrait stealthy = new BaseTrait();

        stealthy.attributes.Add(Attribute.Fighting.ToString(), 2);
        stealthy.attributes.Add(Attribute.Strength.ToString(), 0);
        stealthy.attributes.Add(Attribute.Tracking.ToString(), 3);
        stealthy.attributes.Add(Attribute.Food.ToString(), 0);

        //        stealthy.inheritanceChance = 0.1f;

        stealthy.name       = traitString;
        stealthy.type       = traitString;
        stealthy.traitClass = null;

        instantiatedTraits[traitString] = stealthy;
        return(stealthy);
    }
    public static BaseTrait createDig()
    {
        string traitString = Traits.Dig.ToString();

        if (instantiatedTraits.ContainsKey(traitString))
        {
            return(instantiatedTraits[traitString]);
        }
        BaseTrait dig = new BaseTrait();

        dig.attributes.Add(Attribute.Fighting.ToString(), 1);
        dig.attributes.Add(Attribute.Strength.ToString(), 1);
        dig.attributes.Add(Attribute.Tracking.ToString(), 0);
        dig.attributes.Add(Attribute.Food.ToString(), 0);

        //        dig.inheritanceChance = 0.1f;

        dig.name       = traitString;
        dig.type       = traitString;
        dig.traitClass = null;

        instantiatedTraits[traitString] = dig;
        return(dig);
    }
    public static BaseTrait createClimb()
    {
        string traitString = Traits.Climb.ToString();

        if (instantiatedTraits.ContainsKey(traitString))
        {
            return(instantiatedTraits[traitString]);
        }
        BaseTrait climb = new BaseTrait();

        climb.attributes.Add(Attribute.Fighting.ToString(), 0);
        climb.attributes.Add(Attribute.Strength.ToString(), 1);
        climb.attributes.Add(Attribute.Tracking.ToString(), 0);
        climb.attributes.Add(Attribute.Food.ToString(), 0);

        //        climb.inheritanceChance = 0.1f;

        climb.name       = traitString;
        climb.type       = traitString;
        climb.traitClass = null;

        instantiatedTraits[traitString] = climb;
        return(climb);
    }
    public static BaseTrait createSwim()
    {
        string traitString = Traits.Swim.ToString();

        if (instantiatedTraits.ContainsKey(traitString))
        {
            return(instantiatedTraits[traitString]);
        }
        BaseTrait swim = new BaseTrait();

        swim.attributes.Add(Attribute.Fighting.ToString(), 0);
        swim.attributes.Add(Attribute.Strength.ToString(), 0);
        swim.attributes.Add(Attribute.Tracking.ToString(), 0);
        swim.attributes.Add(Attribute.Food.ToString(), 0);

        //        swim.inheritanceChance = 0.1f;

        swim.name       = traitString;
        swim.type       = traitString;
        swim.traitClass = null;

        instantiatedTraits[traitString] = swim;
        return(swim);
    }
    public static BaseTrait createQuick()
    {
        if (instantiatedTraits.ContainsKey(Traits.Quick.ToString()))
        {
            return(instantiatedTraits[Traits.Quick.ToString()]);
        }
        BaseTrait quick = new BaseTrait();

        quick.attributes.Add(Attribute.Fighting.ToString(), -1);
        quick.attributes.Add(Attribute.Strength.ToString(), 0);
        quick.attributes.Add(Attribute.Tracking.ToString(), 1);
        quick.attributes.Add(Attribute.Food.ToString(), 0);

//        quick.inheritanceChance = 0.0f;

        quick.name       = Traits.Quick.ToString();
        quick.type       = Traits.Quick.ToString();
        quick.traitClass = TraitClass.Speed.ToString();

        quick.linkageMap.Add(Traits.Weak.ToString(), 2.0f);

        instantiatedTraits[Traits.Quick.ToString()] = quick;
        return(quick);
    }
    public static BaseTrait createSlow()
    {
        if (instantiatedTraits.ContainsKey(Traits.Slow.ToString()))
        {
            return(instantiatedTraits[Traits.Slow.ToString()]);
        }
        BaseTrait slow = new BaseTrait();

        slow.attributes.Add(Attribute.Fighting.ToString(), -1);
        slow.attributes.Add(Attribute.Strength.ToString(), 0);
        slow.attributes.Add(Attribute.Tracking.ToString(), 0);
        slow.attributes.Add(Attribute.Food.ToString(), 0);

        slow.inheritanceChance = 1.0f;

        slow.name       = Traits.Slow.ToString();
        slow.type       = Traits.Slow.ToString();
        slow.traitClass = TraitClass.Speed.ToString();

        slow.linkageMap.Add(Traits.Strong.ToString(), 3.0f);

        instantiatedTraits[Traits.Slow.ToString()] = slow;
        return(slow);
    }
    public static BaseTrait createDelicious()
    {
        string traitString = Traits.Delicious.ToString();

        if (instantiatedTraits.ContainsKey(traitString))
        {
            return(instantiatedTraits[traitString]);
        }
        BaseTrait delicious = new BaseTrait();

        delicious.attributes.Add(Attribute.Fighting.ToString(), 0);
        delicious.attributes.Add(Attribute.Strength.ToString(), 0);
        delicious.attributes.Add(Attribute.Tracking.ToString(), 0);
        delicious.attributes.Add(Attribute.Food.ToString(), 3);

        //        delicious.inheritanceChance = 0.1f;

        delicious.name       = traitString;
        delicious.type       = traitString;
        delicious.traitClass = null;

        instantiatedTraits[traitString] = delicious;
        return(delicious);
    }
    public static BaseTrait createKeenSmell()
    {
        string traitString = Traits.KeenSmell.ToString();

        if (instantiatedTraits.ContainsKey(traitString))
        {
            return(instantiatedTraits[traitString]);
        }
        BaseTrait keenSmell = new BaseTrait();

        keenSmell.attributes.Add(Attribute.Fighting.ToString(), 0);
        keenSmell.attributes.Add(Attribute.Strength.ToString(), 0);
        keenSmell.attributes.Add(Attribute.Tracking.ToString(), 4);
        keenSmell.attributes.Add(Attribute.Food.ToString(), 0);

//        keenSmell.inheritanceChance = 0.1f;

        keenSmell.name       = traitString;
        keenSmell.type       = traitString;
        keenSmell.traitClass = null;

        instantiatedTraits[traitString] = keenSmell;
        return(keenSmell);
    }
Beispiel #22
0
 public virtual bool isCompatible(BaseTrait other)
 {
     return(!(this.type == other.type || (traitClass != null && traitClass == other.traitClass)));
 }
 public override bool isCompatible(BaseTrait other)
 {
     return(this.type == other.type);
 }