Exemple #1
0
        public WeaponAttack(OffenseStats offense, CharacterSize size, IWeaponAttackStatistics weapon)
        {
            this.offenseAbilities = offense;
            this.size             = size;
            this.Weapon           = weapon;
            this.Name             = weapon.Name;
            this.Range            = weapon.Range;
            this.DamageType       = weapon.DamageType.ToString();
            this.CriticalThreat   = weapon.CriticalThreat;

            this.CriticalModifier = new BasicStat(string.Format("{0} Critical Modifier", weapon.Name), weapon.CriticalModifier);

            this.attackBonus = new BasicStat(string.Format("{0} Attack Bonus", weapon.Name), weapon.AttackModifier);
            this.attackBonus.AddModifier(new WeaponProficiencyAttackModifier(this.offenseAbilities, this.Weapon));
            this.attackBonus.AddModifiers(MultipleAttackBonusModifier.GetConditionalMultipleAttackModifiers());

            this.DamageModifier = new BasicStat(string.Format("{0} Damage Modifier", weapon.Name), 0);
            foreach (var weaponModifier in offense.WeaponModifiers)
            {
                if (weaponModifier.WeaponQualifies(weapon))
                {
                    weaponModifier.ApplyModifier(this);
                }
            }
        }
Exemple #2
0
        /// <summary>
        /// Converts the size of the damage by.
        /// </summary>
        /// <returns>The damage by size.</returns>
        /// <param name="mediumDamageAmount">Medium damage amount.</param>
        /// <param name="size">Size of the character.</param>
        public static string ConvertDamageBySize(string mediumDamageAmount, CharacterSize size)
        {
            //Drop the modifier
            Cup dice = DiceStrings.ParseDice(mediumDamageAmount);

            return(ConvertDamageBySize(dice, size).ToString());
        }
Exemple #3
0
 public RangeAttack(OffenseStats offenseAbilities,
                    CharacterSize size,
                    IWeapon weapon) : base(offenseAbilities, size, weapon)
 {
     AttackBonus.AddModifier(new StatisticStatModifier("Range Attack Bonus", offenseAbilities.RangeAttackBonus));
     this.AttackType = AttackTypes.Ranged;
 }
Exemple #4
0
 public MeleeAttack(OffenseStats offenseAbilities,
                    AbilityScore strength,
                    CharacterSize size,
                    IWeaponAttackStatistics weapon) : base(offenseAbilities, size, weapon)
 {
     this.strength = strength;
     AttackBonus.AddModifier(new StatisticStatModifier("Melee Attack Bonus", offenseAbilities.MeleeAttackBonus));
     DamageModifier.AddModifier(this.strength.UniversalStatModifier);
     this.AttackType = AttackTypes.Melee;
 }
Exemple #5
0
        /// <summary>
        /// Sets the size of the character.
        /// </summary>
        /// <param name="size">Size category of character.</param>
        /// <param name="height">Height of character.</param>
        /// <param name="weight">Weight of character.</param>
        public void SetSize(CharacterSize size, int height, int weight)
        {
            this.Size         = size;
            this.Height       = height;
            this.Weight       = weight;
            this.SizeModifier = (int)size;

            this.UpdateStealth();
            this.UpdateFly();
        }
Exemple #6
0
        public Weather()
        {
            climate   = Climate.Temperate;
            elevation = Elevation.SeaLevel;
            season    = Season.Spring;
            precipitationIntensity = PrecipitationIntensity.Heavy;
            precipitationFrequency = PrecipitationFrequency.Intermittent;
            precipitationForm      = PrecipitationForm.RainHeavy;
            cloudCover             = CloudCover.CloudsMedium;
            windStrength           = WindStrength.Light;
            windCheckSize          = CharacterSize.None;
            windBlownAwaySize      = CharacterSize.None;
            severeWeatherEvent     = SevereWeatherEvent.None;

            inDesert      = false;
            isDay         = true;
            nightTempDrop = 0;

            RecalculateAll(true);
        }
Exemple #7
0
        /// <summary>
        /// Converts the size of the damage by.
        /// </summary>
        /// <returns>The damage by size.</returns>
        /// <param name="mediumDamageAmount">Medium damage amount.</param>
        /// <param name="size">Size of the character.</param>
        public static string ConvertDamageBySize(string mediumDamageAmount, CharacterSize size)
        {
            int index = mediumDamageTable.IndexOf(mediumDamageAmount);

            switch (size)
            {
            case CharacterSize.Tiny:
                return(tinyDamageTable[index]);

            case CharacterSize.Small:
                return(smallDamageTable[index]);

            case CharacterSize.Medium:
                return(mediumDamageAmount);

            case CharacterSize.Large:
                return(largeDamageTable[index]);
            }

            throw new NotImplementedException(string.Format("Character Size: {0} has not been implemented in damage tables.", size));
        }
    protected override void OnAwake()
    {
        base.OnAwake();

        // Retrieves the desired components
        _characterSize = GetComponentInParent<CharacterSize>();
        _renderers = GetComponentsInChildren<Renderer>();
        _gcic = GameObject.FindGameObjectWithTag(Tags.GameController).GetComponent<GameControllerIndependentControl>();
        _character = _characterSize.gameObject;

        // Selects an index for this object
        _index = -indexStep * nextAvailableIndex;	// The index is negative
        nextAvailableIndex++;

        // Sets the controlled flag to false by default
        _wasControlled = false;

        // Sets the renderers' order to the index
        foreach (Renderer renderer in _renderers)
            renderer.sortingOrder += _index;
    }
Exemple #9
0
        public void Initialize(ComponentContainer components)
        {
            this.monkLevels = components.Get <ClassLevel>();
            for (int i = 1; i < 10; i++)
            {
                this.AttackBonus.AddModifier(
                    new ConditionalStatModifier(
                        new FlurryOfBlowsAttackBonusModifier(this, i),
                        "attack {0}".Formatted(i)
                        )
                    );
            }
            var strength = components.Get <AbilityScores>().GetAbility(AbilityScoreTypes.Strength);

            this.AttackBonus.AddModifier(strength.UniversalStatModifier);
            this.DamageModifier.AddModifier(strength.UniversalStatModifier);
            var monk = components.Get <MonkUnarmedStrike>();

            this.unarmedStrike = monk.Weapon;
            this.size          = components.Get <SizeStats>().Size;
        }
Exemple #10
0
        public static Cup ConvertDamageBySize(Cup dice, CharacterSize size)
        {
            Cup converted = new Cup();

            converted.Modifier = dice.Modifier;
            dice.Modifier      = 0;
            var dieString = dice.ToString();

            int index = mediumDamageTable.IndexOf(dieString);

            if (index == -1)
            {
                throw new DamageTableValueNotFoundException(dieString);
            }

            switch (size)
            {
            case CharacterSize.Tiny:
                converted.AddDice(DiceStrings.ParseDice(tinyDamageTable[index]).Dice);
                break;

            case CharacterSize.Small:
                converted.AddDice(DiceStrings.ParseDice(smallDamageTable[index]).Dice);
                break;

            case CharacterSize.Medium:
                converted.AddDice(DiceStrings.ParseDice(mediumDamageTable[index]).Dice);
                break;

            case CharacterSize.Large:
                converted.AddDice(DiceStrings.ParseDice(largeDamageTable[index]).Dice);
                break;

            default:
                throw new NotImplementedException(string.Format("Character Size: {0} has not been implemented in damage tables.", size));
            }

            return(converted);
        }
Exemple #11
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SilverNeedle.Characters.SizeStats"/> class.
 /// </summary>
 /// <param name="size">Size class of the character.</param>
 public SizeStats(CharacterSize size)
     : this(size, 72, 180)
 {
 }
 /// <summary>
 /// Unity's method called when the entity is created.
 /// Recovers the desired componentes of the entity.
 /// </summary>
 public void Awake()
 {
     ccc = GetComponent<CharacterControllerCustom>();
     _shootTrajectory = GetComponent<CharacterShootTrajectory>();
     size = GetComponent<CharacterSize>();
     _independentControl = GameObject.FindGameObjectWithTag(Tags.GameController)
                             .GetComponent<GameControllerIndependentControl>();
 }
Exemple #13
0
    private void SetCharacterSize(CharacterSize size)
    {
        _characterSize = size;

        transform.localScale = new Vector3(1f, 1f, 1f) * (((float)(_characterSize) + 1f) / 2f);
    }
 /// <summary>
 /// Unity's method called right after the object is created.
 /// </summary>
 void Awake()
 {
     // Retrieves the desired components
     _ccc = GetComponentInParent<CharacterControllerCustom>();
     _characterSize = GetComponentInParent<CharacterSize>();
     _characterFusion = GetComponentInParent<CharacterFusion>();
     _characterShoot = GetComponentInParent<CharacterShoot>();
     _animator = GetComponent<Animator>();
     _gcic = GameObject.FindGameObjectWithTag(Tags.GameController).GetComponent<GameControllerIndependentControl>();
     _drop = transform.parent.gameObject;
 }
 void Awake()
 {
     // Retrieves the desired components
     _transform = transform;
     _ccc = GetComponent<CharacterControllerCustom>();
     _characterSize = GetComponent<CharacterSize>();
     _characterFusion = GetComponent<CharacterFusion>();
     _characterShoot = GetComponent<CharacterShoot>();
     _controller = GetComponent<CharacterController>();
     _gcic = GameObject.FindGameObjectWithTag(Tags.GameController).GetComponent<GameControllerIndependentControl>();
 }
    /// <summary>
    /// Initialize everything
    /// </summary>
    public void Awake()
    {
        _ccc = GetComponent<CharacterControllerCustom>();
        _sizeDrop = GetComponent<CharacterSize>();
        modelDrop = GetComponentInChildren<CharacterModelController>();

        _trajectoryPoints = new Vector3[numOfTrajectoryPoints];

        for (int i = 0; i < numOfTrajectoryPoints; i++) {
            _trajectoryPoints[i] = transform.position;
        }

        _linerenderer = (LineRenderer)Instantiate(renderer);
        _linerenderer.transform.parent = this.transform;

        //create the object where to store particles
        _rainParticles = new GameObject();
        _rainParticles.transform.parent = this.transform;
        _rainParticles.name = "Rainbow Particle";
        //we init only 20, we usually don't use more. If needed, will create more
        _particlesTrajectory = new List<ParticleSystem[]>(20);
        for (int i = 0; i < 20; i++) {
            GameObject system = Instantiate(particleRainbow);
            system.transform.parent = _rainParticles.transform;

            //initialize particle system
            ParticleSystem[] subSystems = system.GetComponentsInChildren<ParticleSystem>();
            foreach (ParticleSystem subSystem in subSystems) {
                subSystem.randomSeed = (uint)UnityEngine.Random.Range(0, int.MaxValue);
                subSystem.Simulate(0, true, true);
                subSystem.Play();

                ParticleSystem.EmissionModule emission = subSystem.emission;
                emission.enabled = false;
            }
            _particlesTrajectory.Add(subSystems);
        }
    }
    /// <summary>
    /// Unity's method called right after the object is created.
    /// </summary>
    void Awake()
    {
        // Retrieves the desired components
        _ccc = GetComponentInParent<CharacterControllerCustom>();
        _characterSize = GetComponentInParent<CharacterSize>();
        _characterShoot = GetComponentInParent<CharacterShoot>();
        _characterShootTrajectory = GetComponentInParent<CharacterShootTrajectory>();
        _eyesAttacher = GetComponent<EyesAttacher>();
        _transform = transform;
        _parent = _transform.parent;

        // Saves the model offset
        _originalModelOffset = _transform.localPosition;

        // Gets the joint information
        _joints = GetComponentsInChildren<Joint>();
        _jointsConnectedBodies = _joints.Select(e => e.connectedBody).ToArray();
        _originalJointsPosition = _joints.Select(e => e.transform.localPosition).ToArray();
    }
 // Use this for initialization
 void Awake()
 {
     _independentControl = GameObject.FindGameObjectWithTag(Tags.GameController)
                             .GetComponent<GameControllerIndependentControl>();
     _characterSize = GetComponent<CharacterSize>();
 }
Exemple #19
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SilverNeedle.Characters.SizeStats"/> class.
 /// </summary>
 /// <param name="size">Size class of the character.</param>
 /// <param name="height">Height of the character.</param>
 /// <param name="weight">Weight of the character.</param>
 public SizeStats(CharacterSize size, int height, int weight)
 {
     this.SetupSkillModifiers();
     this.SetSize(size, height, weight);
 }
Exemple #20
0
        private void SetWindStrength(bool reroll)
        {
            if (reroll)
            {
                windStrengthRoll = DiceRoller.RollD100();
            }

            if (windStrengthRoll <= 50)
            {
                windStrength = WindStrength.Light;
                if (reroll)
                {
                    windSpeed = DiceRoller.RandomRangeNumber(0, 10);
                }
                windCheckSize         = CharacterSize.None;
                windBlownAwaySize     = CharacterSize.None;
                windSkillCheckPenalty = 0;
            }
            else if (windStrengthRoll >= 51 && windStrengthRoll <= 80)
            {
                windStrength = WindStrength.Moderate;
                if (reroll)
                {
                    windSpeed = DiceRoller.RandomRangeNumber(11, 20);
                }
                windCheckSize         = CharacterSize.None;
                windBlownAwaySize     = CharacterSize.None;
                windSkillCheckPenalty = 0;
            }
            else if (windStrengthRoll >= 81 && windStrengthRoll <= 90)
            {
                windStrength = WindStrength.Strong;
                if (reroll)
                {
                    windSpeed = DiceRoller.RandomRangeNumber(21, 30);
                }
                windCheckSize         = CharacterSize.Tiny;
                windBlownAwaySize     = CharacterSize.None;
                windSkillCheckPenalty = -2;
            }
            else if (windStrengthRoll >= 91 && windStrengthRoll <= 95)
            {
                windStrength = WindStrength.Severe;
                if (reroll)
                {
                    windSpeed = DiceRoller.RandomRangeNumber(31, 50);
                }
                windCheckSize         = CharacterSize.Small;
                windBlownAwaySize     = CharacterSize.Tiny;
                windSkillCheckPenalty = -4;
            }
            else if (windStrengthRoll >= 96 && windStrengthRoll <= 100)
            {
                windStrength = WindStrength.Windstorm;
                if (reroll)
                {
                    windSpeed = DiceRoller.RandomRangeNumber(51, 300);
                }
                windCheckSize         = CharacterSize.Medium;
                windBlownAwaySize     = CharacterSize.Small;
                windSkillCheckPenalty = -8;
            }
        }
Exemple #21
0
    /// <summary>
    /// Check the drops inside the area and update their state
    /// </summary>
    protected void CheckDropInside()
    {
        //Get the collisions/trigger area
        LayerMask layerCast = (1 << LayerMask.NameToLayer("Character"));
        Collider[] drops = AIMethods.DropInTriggerArea(triggerArea, transform.position, layerCast);

        int sizeDrop = 0;

        //if no drops in trigger area or not in the list, no priority drops
        if (drops.Length == 0) commonParameters.priorityDrop = false;

        //si la gota prioritaria está fuera del trigger y hay otra dentro, al momento
        //del ataque, se expulsa a la otra gota
        //ir a dentro del for, y comprobar que la prioritaria está dentro del trigger o ya está expulsada

        //priority drop
        // 1. the drop in air trigger (usually is controlled)
        // 2. drop inside, preference by distance
        // 3. if selected drop is near, attack it

        //clear drop if no priority was setted
        if (!commonParameters.priorityDrop) commonParameters.drop = null;
        //delete priority
        commonParameters.priorityDrop = false;

        //keep track of drop index
        int dropIndex = -1;
        float distance = float.MaxValue;
        bool hasPriority = false;

        //check the list of drop inside the trigger area
        for (int i = 0; i < drops.Length && !hasPriority; i++) {
            Collider dropCollider = drops[i];

            //if has a drop (priority drop) and found it, we have a drop priority
            //end loop
            if (commonParameters.drop != null && drops[i].gameObject == commonParameters.drop) {
                hasPriority = true;
            }

            //if drop is under controll, check the distance and get the closest drop
            if (_independentControl.IsUnderControl(dropCollider.gameObject)) {
                float newDistance = Vector2.Distance(dropCollider.transform.position,
                                                commonParameters.enemy.transform.position);
                if (newDistance > distance) continue;
                distance = newDistance;
                dropIndex = i;
            }
        }

        //if we have a drop and no found a priority drop
        //because there is no one, or the priority drop is outside
        if (!hasPriority && dropIndex >= 0) {
            //store the drop
            commonParameters.drop = drops[dropIndex].gameObject;
            _sizeDetected = commonParameters.drop.GetComponent<CharacterSize>();
            sizeDrop = _sizeDetected.GetSize();

            //if founded a priority, the drop was setted, restore the priority and
            //update the size
        } else if (hasPriority) {
            commonParameters.priorityDrop = true;
            _sizeDetected = commonParameters.drop.GetComponent<CharacterSize>();
            sizeDrop = _sizeDetected.GetSize();
        }

        //update size
        _animator.SetInteger("SizeDrop", sizeDrop);
        //check if the selected drop is near
        DropNear();
    }
    /// <summary>
    /// Unity's method called right after the object is created.
    /// </summary>
    void Awake()
    {
        // Retrieves the desired components
        _originalAudioSource = GetComponent<AudioSource>();
        _ccc = GetComponent<CharacterControllerCustom>();
        _characterSize = GetComponent<CharacterSize>();
        _characterFusion = GetComponent<CharacterFusion>();
        _characterShoot = GetComponent<CharacterShoot>();

        // The walk's audio source is the original one
        walk.audioSource = _originalAudioSource;

        // Creates a copy of the audio source for the other sounds
        jump.audioSource = SoundUtility.CopyAudioSource(_originalAudioSource, gameObject);
        land.audioSource = SoundUtility.CopyAudioSource(_originalAudioSource, gameObject);
        fuse.audioSource = SoundUtility.CopyAudioSource(_originalAudioSource, gameObject);
        shoot.audioSource = SoundUtility.CopyAudioSource(_originalAudioSource, gameObject);
        hit.audioSource = SoundUtility.CopyAudioSource(_originalAudioSource, gameObject);
        irrigate.audioSource = SoundUtility.CopyAudioSource(_originalAudioSource, gameObject);
    }
    /// <summary>
    /// Unity's method called as soon as this entity is created.
    /// It will be called even if the entity is disabled.
    /// </summary>
    public void Awake()
    {
        // Creates the original state
        State = new CharacterControllerState();

        // Initializes the parameter's stack and lists
        _overrideParameters = new Stack<CharacterControllerParameters>();
        _collisions = new List<Collider>();
        _listeners = new List<CharacterControllerListener>();

        // Recovers the desired components
        _transform = transform;
        _controller = GetComponent<CharacterController>();
        _characterSize = GetComponent<CharacterSize>();

        // Ignores the collisions with the hat layer
        Physics.IgnoreLayerCollision(LayerMask.NameToLayer("Character"), LayerMask.NameToLayer("Cloth"), true);
    }