예제 #1
0
        static bool Prefix(PreciseStrike __instance, RulePrepareDamage evt)
        {
            if (!evt.Target.isFlankedByAttacker(__instance.Owner.Unit) || evt.DamageBundle.Weapon == null)
            {
                return(false);
            }
            bool flag = (bool)__instance.Owner.State.Features.SoloTactics;

            if (!flag)
            {
                foreach (UnitEntityData unitEntityData in evt.Target.CombatState.EngagedBy)
                {
                    flag = unitEntityData.Descriptor.HasFact(__instance.PreciseStrikeFact) && unitEntityData != __instance.Owner.Unit;
                    if (flag && evt.Target.isFlankedByAttacker(unitEntityData))
                    {
                        break;
                    }
                }
            }
            if (!flag)
            {
                return(false);
            }
            BaseDamage damage = __instance.Damage.CreateDamage();

            evt.DamageBundle.Add(damage);
            return(false);
        }
예제 #2
0
 public virtual void onBulletHit(RaycastHit hit)
 {
     //Debug.Log ("HADISH INTO " + hit.transform);
     if (!wasDamage)
     {
         if (owner == hit.transform.gameObject) {
             return;
         }
         if (hit.transform.gameObject.CompareTag ("decoration")) {
             sControl.playClip (HitSound);
             wasDamage = true;
             //Debug.Log ("HADISH INTO " + hit.transform.gameObject.name);
         }
         DamagebleObject obj = hit.transform.gameObject.GetComponent <DamagebleObject>();
         if (obj != null) {
             sControl.playClip (HitSound);
             wasDamage = true;
             BaseDamage lDamage  = new BaseDamage(damage);
             //lDamage.pushDirection = hit.point;
             lDamage.hitPosition = hit.point;
             obj.Damage(lDamage,owner.gameObject);
             //Debug.Log ("HADISH INTO SOME PLAYER! " + hit.transform.gameObject.name);
         }
     }
 }
예제 #3
0
        private int DealHitPointsDamage(ContextActionDealDamage2.DamageInfo info)
        {
            if (this.Context.MaybeCaster == null)
            {
                UberDebug.LogError(this, (object)"Caster is missing", (object[])Array.Empty <object>());
                return(0);
            }
            BaseDamage damage1 = this.DamageType.GetDamageDescriptor(info.Dices, info.Bonus).CreateDamage();

            damage1.EmpowerBonus = !info.Empower ? damage1.EmpowerBonus : 1.5f;
            damage1.Maximized    = info.Maximize || damage1.Maximized;
            BaseDamage baseDamage = damage1;
            DamageCriticalModifierType?criticalModifier = info.CriticalModifier;
            int?critModifier = criticalModifier.HasValue ? new int?(criticalModifier.GetValueOrDefault().IntValue()) : new int?();

            baseDamage.CriticalModifier = critModifier;
            damage1.Half           = this.Half;
            damage1.AlreadyHalved  = info.PreRolledValue.HasValue && this.Half && this.AlreadyHalved;
            damage1.PreRolledValue = info.PreRolledValue;
            if (this.IsAoE && !info.PreRolledValue.HasValue)
            {
                int?nullable2 = this.Context.AoEDamage.Get <ContextActionDealDamage, int?>(this, new int?());
                if (nullable2.HasValue)
                {
                    damage1.PreRolledValue = nullable2;
                }
            }
            ContextAttackData data    = ElementsContext.GetData <ContextAttackData>();
            DamageBundle      damage2 = (DamageBundle)damage1;

            damage2.Weapon = data?.AttackRoll?.Weapon;
            RuleDealDamage rule = new RuleDealDamage(this.Context.MaybeCaster, this.Target.Unit, damage2)
            {
                Projectile             = data?.Projectile,
                AttackRoll             = data?.AttackRoll,
                HalfBecauseSavingThrow = info.HalfBecauseSavingThrow,
                MinHPAfterDamage       = !this.UseMinHPAfterDamage ? new int?() : new int?(this.MinHPAfterDamage),
                SourceAbility          = this.Context.SourceAbility,
                SourceArea             = this.Context.AssociatedBlueprint as BlueprintAbilityAreaEffect
            };

            if (this.IsShadowEvocation)
            {
                RuleSavingThrow ruleSavingThrow = this.Context.TriggerRule(new RuleSavingThrow(this.Target.Unit, SavingThrowType.Will, this.Context.Params.DC));
                rule.ReducedBecauseOfShadowEvocation = ruleSavingThrow.IsPassed;
            }
            if (this.IsShadowEvocationGreater)
            {
                RuleSavingThrow ruleSavingThrow = this.Context.TriggerRule(new RuleSavingThrow(this.Target.Unit, SavingThrowType.Will, this.Context.Params.DC));
                rule.ReducedBecauseOfShadowEvocationGreater = ruleSavingThrow.IsPassed;
            }
            this.Context.TriggerRule <RuleDealDamage>(rule);
            if (this.IsAoE && !this.Context.AoEDamage.Get <ContextActionDealDamage, int?>(this, new int?()).HasValue)
            {
                this.Context.AoEDamage[this] = new int?(rule.Calculate.CalculatedDamage.FirstItem <DamageValue>().RolledValue);
            }
            return(rule.Damage);
        }
    public virtual void Damage(BaseDamage damage,GameObject killer)
    {
        if (destructableObject){
            health-= damage.Damage;
            if(health<0){
                KillIt(killer);

            }
        }
    }
예제 #5
0
 public override void Damage(BaseDamage damage,GameObject killer)
 {
     float dmgflaot =damage.Damage;
             if(Critical){
                 dmgflaot*=2;
             }
             //Debug.Log (killer.ToString()+ damage);
             hitCounter.ShootCnt(killer);
             PlayerMainGui.instance.AddMessage(dmgflaot.ToString(),transform.position,PlayerMainGui.MessageType.DMG_TEXT);
 }
        public override bool Bypassed(BaseDamage damage, ItemEntityWeapon weapon)
        {
            EnergyDamage energyDamage = damage as EnergyDamage;

            if (energyDamage != null)
            {
                return(energyDamage.EnergyType != this.Type);
            }
            return(true);
        }
 public virtual void Damage(BaseDamage damage, GameObject killer)
 {
     if (destructableObject)
     {
         health -= damage.Damage;
         if (health < 0)
         {
             KillIt(killer);
         }
     }
 }
예제 #8
0
    public override void Damage(BaseDamage damage, GameObject killer)
    {
        float dmgflaot = damage.Damage;

        if (Critical)
        {
            dmgflaot *= 2;
        }
        //Debug.Log (killer.ToString()+ damage);
        hitCounter.ShootCnt(killer);
        PlayerMainGui.instance.AddMessage(dmgflaot.ToString(), transform.position, PlayerMainGui.MessageType.DMG_TEXT);
    }
예제 #9
0
 public void DamagePawn(BaseDamage damage)
 {
     if (!photonView.isMine) {
         return;
     }
     if (damage.sendMessage) {
         if(damage.isContinius){
             PlayerMainGui.instance.AddMessage ((damage.Damage/Time.deltaTime).ToString ("0.0"), damage.hitPosition, PlayerMainGui.MessageType.DMG_TEXT);
         }else{
             PlayerMainGui.instance.AddMessage (damage.Damage.ToString (), damage.hitPosition, PlayerMainGui.MessageType.DMG_TEXT);
         }
     }
 }
예제 #10
0
        public BaseDamageMod GetBaseDamageMod()
        {
            var attackType   = GetCombatType();
            var damageSource = attackType == CombatType.Melee ? GetEquippedWeapon() : GetEquippedAmmo();

            if (damageSource == null)
            {
                var baseDamage = new BaseDamage(5, 0.2f);   // 1-5
                return(new BaseDamageMod(baseDamage));
            }
            else
            {
                return(damageSource.GetDamageMod(this));
            }
        }
예제 #11
0
    void DamageBase()
    {
        var fx = Instantiate(deathFX, transform.position, Quaternion.identity);

        fx.Play();

        Destroy(fx.gameObject, fx.main.duration);

        BaseDamage Base = FindObjectOfType <BaseDamage>();

        Base.DamageBase(baseDamage);
        GetComponent <AudioSource>().PlayOneShot(damageBaseSFX);

        Destroy(gameObject);
    }
예제 #12
0
 public virtual void Damage(BaseDamage damage,GameObject killer)
 {
     if (TargetHarm)
     {
         damage.Damage *= multiDamage;
         TargetHarm.Damage(damage, killer);
         /*if (!TargetHarm.isDead)
         {
             if (TargetHarm.health>damage*multiDamage) {TargetHarm.health -= damage*multiDamage;} else
             {
                 TargetHarm.health = 0f;
                 TargetHarm.isDead = true;
             }
         }*/
     }
 }
예제 #13
0
 /// <summary>
 /// Formula for damage mitigation based upon damage type.
 /// </summary>
 /// <param name="Type">Type of damage incoming.</param>
 /// <param name="Amount">Amount of damage received.</param>
 /// <returns>Reduced damage based upon resistances/armour.</returns>
 public override float MitigateDamge(BaseDamage Type, float Amount)
 {
     if (Type == BaseDamage.Physical)
     {                                                                     // physical damage?
         if (CurrentArmour + BonusArmour > 0)
         {                                                                 // has armour?
             Amount -= (ARMOUR_REDUCTION * (CurrentArmour + BonusArmour)); // apply armour mitigation
         }
     }
     if ((Resist[(int)Type].Value + ResistModTotals[(int)Type].Value) > 0)
     {                                                                                                     // has resistance to this damage type?
         return(Amount - ((Amount / 100) * (Resist[(int)Type].Value + ResistModTotals[(int)Type].Value))); // apply resistance mitigation
     }
     else  // no resistance mitigation
     {
         return(Amount);  // unmodified damage value
     }
 }
예제 #14
0
    public void DealDamage(CreatureStats from, CreatureStats to, int number, IDamage damage = null)
    {
        if (damage == null)
        {
            damage = new BaseDamage();
        }

        int realDamage = damage.GetCalculate(to, number);

        to.HP -= realDamage;

        if (to.HP <= 0)
        {
            OnDeathPlayer?.Invoke(to, damage);
        }
        Debug.LogFormat("{0} наносит {1} урон {2}", from.name, realDamage, to.name);
        OnDealDamage?.Invoke(to, damage);
    }
예제 #15
0
 /// <summary>
 /// Calculates the Damage dealt
 /// </summary>
 /// <returns>The Damage that will be dealt</returns>
 public int RollDamage()
 {
     // If there is an equipped weapon, get the roll results of the dice
     if (EquippedWeapon != null)
     {
         int result = 0;
         for (int dice = 1; dice <= EquippedWeapon.NumberOfDice; dice++)
         {
             result += EquippedWeapon.DamageDie.GetRollResult();
         }
         return(result);
     }
     else
     {
         //Otherwise, we're punching with fists
         return(BaseDamage.GetRollResult());
     }
 }
예제 #16
0
        protected override void WriteDataXML(XElement ele, ElderScrollsPlugin master)
        {
            XElement subEle;

            ele.TryPathTo("Value", true, out subEle);
            subEle.Value = Value.ToString();

            ele.TryPathTo("Health", true, out subEle);
            subEle.Value = Health.ToString();

            ele.TryPathTo("Weight", true, out subEle);
            subEle.Value = Weight.ToString("G15");

            ele.TryPathTo("BaseDamage", true, out subEle);
            subEle.Value = BaseDamage.ToString();

            ele.TryPathTo("ClipSize", true, out subEle);
            subEle.Value = ClipSize.ToString();
        }
예제 #17
0
        // Token: 0x0600187F RID: 6271 RVA: 0x000A0388 File Offset: 0x0009E588
        public override void OnEventAboutToTrigger(RuleCalculateDamage evt)
        {
            BaseDamage  baseDamage = evt.DamageBundle.FirstOrDefault <BaseDamage>();
            AbilityData ability    = evt.Reason.Ability;

            if (ability == null || ability.Blueprint.School != SpellSchool.Evocation || baseDamage == null)
            {
                return;
            }
            int classLevels = 0;

            foreach (var thisClass in this.Wizards)
            {
                classLevels += base.Owner.Progression.GetClassLevel(thisClass);
            }
            if (evt.ParentRule.Projectile == null || evt.ParentRule.Projectile.IsFirstProjectile)
            {
                int bonusDamage = Math.Max(classLevels / 2, 1);
                baseDamage.AddBonus(bonusDamage);
            }
        }
예제 #18
0
 // SUMMER FUNCTION :
 public void Summer()
 {
     SummerUI.SetActive(true);
     if (displayDate >= 37)
     {
         if (displayDate == 37)
         {// SHREEYA :- HARSH DAMAGE - 1DAY
             if (timeOfDay >= 20 && timeOfDay <= 21)
             {
                 BaseDamage.WeatherDamage();
             }
         }
         harshWeather  = true;
         harshWeathers = true;
         if (displayDate >= 42)
         {
             harshWeather  = false;
             harshWeathers = false;
         }
     }
 }
예제 #19
0
    public override void Damage(BaseDamage damage, GameObject killer)
    {
        Pawn killerPawn = killer.GetComponent <Pawn> ();

        if (killerPawn != null && killerPawn.team == team && !PlayerManager.instance.frendlyFire)
        {
            return;
        }
        if (killerPawn != null)
        {
            Player killerPlayer = killerPawn.player;
            if (killerPlayer != null)
            {
                killerPlayer.DamagePawn(damage.Damage, damage.hitPosition);
            }
        }
        if (photonView.isMine)
        {
            AddEffect(damage.hitPosition);
            float forcePush = charMan.GetFloatChar(CharacteristicList.STANDFORCE);
            ///Debug.Log(forcePush +" "+damage.pushForce);
            forcePush = damage.pushForce - forcePush;
            //Debug.Log(forcePush);
            if (forcePush > 0)
            {
                AddPushForce(forcePush * damage.pushDirection * FORCE_MULIPLIER);
            }
        }
        if (!PhotonNetwork.isMasterClient)
        {
            return;
        }



        //Debug.Log ("DAMAGE");
        base.Damage(damage, killer);
    }
예제 #20
0
    // AUTUMNFUNCTION :
    public void Autumn()
    {
        AutumnUI.SetActive(true);
        if (displayDate >= 62)
        {
            if (displayDate == 62)
            {
                // SHREEYA :- HARSH DAMAGE - 1DAY
                if (timeOfDay >= 20 && timeOfDay <= 21)
                {
                    BaseDamage.WeatherDamage();
                }
            }

            harshWeather  = true;
            harshWeathers = true;
            if (displayDate >= 70)
            {
                harshWeather  = false;
                harshWeathers = false;
            }
        }
    }
예제 #21
0
    // SPRING FUNCTOIN :
    public void Spring()
    {
        springTimer += displayDate;
        SpringUI.SetActive(true);
        if (displayDate >= 10)
        {
            if (displayDate == 10)
            {// SHREEYA :- HARSH DAMAGE - 1DAY
                if (timeOfDay >= 20 && timeOfDay <= 21)
                {
                    BaseDamage.WeatherDamage();
                }
            }


            harshWeather  = true;
            harshWeathers = true;
            if (displayDate >= 15)
            {
                harshWeather  = false;
                harshWeathers = false;
            }
        }
    }
예제 #22
0
        /// <summary>
        /// Returns base damage range for next monster attack
        /// </summary>
        public BaseDamageMod GetBaseDamage(BiotaPropertiesBodyPart attackPart)
        {
            if (CurrentAttack == CombatType.Missile && GetMissileAmmo() != null)
            {
                return(GetMissileDamage());
            }

            // use weapon damage for every attack?
            var weapon = GetEquippedMeleeWeapon();

            if (weapon != null)
            {
                var weaponDamage = weapon.GetDamageMod(this);
                //Console.WriteLine($"{Name} using weapon damage: {weaponDamage}");
                return(weaponDamage);
            }

            var maxDamage = attackPart.DVal;
            var variance  = attackPart.DVar;

            var baseDamage = new BaseDamage(maxDamage, variance);

            return(new BaseDamageMod(baseDamage));
        }
예제 #23
0
    void ExplosionDamage()
    {
        sControl.stopSound ();//останавливаем звук реактивного двигателя
        sControl.playClip (exploseSound);//звук взрыва

        Collider[] hitColliders = Physics.OverlapSphere(transform.position, splashRadius);
        Vector3 Position = transform.position;
        RaycastHit[] hits;
        for(int i=0;i < hitColliders.Length;i++) {

            //Debug.Log(hitColliders[i]);
            bool isHit = false;
            hits = Physics.RaycastAll(Position, hitColliders[i].transform.position);
            for (int j = 0; j < hits.Length; j++) {
                if(hits[j].collider.tag != "Player")
                {
                    isHit = true;
                    break;
                }
            }
            if (isHit) {
                DamagebleObject obj = hitColliders[i].GetComponent <DamagebleObject>();
                BaseDamage lDamage  = new BaseDamage(damage);
                lDamage.pushDirection = mTransform.forward;
                lDamage.hitPosition = mTransform.position;
                if (obj != null&&obj!=shootTarget) {
                    obj.Damage(lDamage,owner);
                }
            }
        }
    }
예제 #24
0
 public void Activate(BaseDamage newDamage, GameObject newOwner)
 {
     isReadyToHit = true;
     damage       = newDamage;
     owner        = newOwner;
 }
 public BaseDamage(BaseDamage old)
 {
     Damage = old.Damage;
     isVsArmor = old.isVsArmor;
     pushForce = old.pushForce;
 }
예제 #26
0
    public override void Damage(BaseDamage damage,GameObject killer)
    {
        if (isSpawn||killer==null||!isActive) {//если только респавнились, то повреждений не получаем
            return;
        }
        bool isVs =( damage.isVsArmor && charMan.GetBoolChar (CharacteristicList.ARMOR))||( !damage.isVsArmor && !charMan.GetBoolChar (CharacteristicList.ARMOR));
        if (!isVs) {
            damage.Damage*=0.5f;
        }
        //вопли при попадании
        //выбираются случайно из массива. Звучат не прерываясь при следующем вызове
        if (lastPainSound + 1.0f<Time.time) {
            lastPainSound =Time.time;
                        sControl.playClipsRandom (painSoundsArray);
        }

        Pawn killerPawn =killer.GetComponent<Pawn> ();
        if (killerPawn != null && killerPawn.team == team &&! PlayerManager.instance.frendlyFire) {
            return;
        }
        if (killerPawn != null){
            Player killerPlayer =  killerPawn.player;
            if(killerPlayer!=null){
                //Debug.Log ("DAMAGE" +damage.sendMessage);
                killerPlayer.DamagePawn(damage);
            }
        }
        AddEffect(damage.hitPosition);
        if (photonView.isMine) {

            float forcePush =  charMan.GetFloatChar(CharacteristicList.STANDFORCE);
            ///Debug.Log(forcePush +" "+damage.pushForce);
            forcePush =damage.pushForce-forcePush;
            //Debug.Log(forcePush);
            if(forcePush>0){
                damage.pushDirection.y=0;
                AddPushForce(forcePush*damage.pushDirection*FORCE_MULIPLIER);

            }

        }
        if (!photonView.isMine){
            return;
        }
        if (isAi) {
            mainAi.WasHitBy(killer);

        }

        //Debug.Log ("DAMAGE");
        base.Damage(damage,killer);
    }
예제 #27
0
    public void DpsCheck()
    {
        //Debug.Log ("dps"+this+activeDPS.Count );
        if (activeDPS.Count > 0) {

            for(int i=0; i<activeDPS.Count;i++){
                singleDPS key  = activeDPS[i];
                BaseDamage ldamage = new BaseDamage(key.damage);
                ldamage.hitPosition =myTransform.position + UnityEngine.Random.onUnitSphere;
                ldamage.isContinius = true;
                ldamage.Damage *= Time.deltaTime;
                key.lastTime=key.lastTime+Time.deltaTime;
                //Debug.Log (key.lastTime);
                if(key.lastTime>1.0f){

                    ldamage.sendMessage = true;
                    key.lastTime=0;
                }else{
                    ldamage.sendMessage = false;
                }

                Damage(ldamage,key.killer);
            }
        }
    }
예제 #28
0
 public void Activate(BaseDamage newDamage,GameObject newOwner)
 {
     isReadyToHit = true;
     damage = newDamage;
         owner = newOwner;
 }
예제 #29
0
    //end seen hear work
    public void addDPS(BaseDamage damage, GameObject killer)
    {
        singleDPS newDPS = new singleDPS ();
        newDPS.damage = damage;
        newDPS.killer = killer;

        activeDPS.Add (newDPS);
    }
예제 #30
0
 public override int GetHashCode()
 {
     return(BaseDamage.GetHashCode());
 }
예제 #31
0
파일: NPC.cs 프로젝트: cvogt/AlbLib
        public override int GetHashCode()
        {
            int hashCode = 0;

            unchecked {
                if (unknown != null)
                {
                    hashCode += 1000000007 * unknown.GetHashCode();
                }
                hashCode += 1000000009 * Type.GetHashCode();
                hashCode += 1000000021 * Gender.GetHashCode();
                hashCode += 1000000033 * Race.GetHashCode();
                hashCode += 1000000087 * Class.GetHashCode();
                hashCode += 1000000093 * Magic.GetHashCode();
                hashCode += 1000000097 * Level.GetHashCode();
                hashCode += 1000000103 * Language.GetHashCode();
                hashCode += 1000000123 * Appearance.GetHashCode();
                hashCode += 1000000181 * Face.GetHashCode();
                hashCode += 1000000207 * InventoryPicture.GetHashCode();
                hashCode += 1000000223 * ActionPoints.GetHashCode();
                hashCode += 1000000241 * DialogueOptions.GetHashCode();
                hashCode += 1000000271 * ResponseOptions.GetHashCode();
                hashCode += 1000000289 * TrainingPoints.GetHashCode();
                hashCode += 1000000297 * Gold.GetHashCode();
                hashCode += 1000000321 * Rations.GetHashCode();
                hashCode += 1000000349 * Conditions.GetHashCode();
                hashCode += 1000000363 * Strength.GetHashCode();
                hashCode += 1000000403 * Intelligence.GetHashCode();
                hashCode += 1000000409 * Dexterity.GetHashCode();
                hashCode += 1000000411 * Speed.GetHashCode();
                hashCode += 1000000427 * Stamina.GetHashCode();
                hashCode += 1000000433 * Luck.GetHashCode();
                hashCode += 1000000439 * MagicResistance.GetHashCode();
                hashCode += 1000000447 * MagicTallent.GetHashCode();
                hashCode += 1000000453 * CloseRangeCombat.GetHashCode();
                hashCode += 1000000459 * LongRangeCombat.GetHashCode();
                hashCode += 1000000483 * CriticalHit.GetHashCode();
                hashCode += 1000000513 * Lockpicking.GetHashCode();
                hashCode += 1000000531 * LifePoints.GetHashCode();
                hashCode += 1000000579 * SpellPoints.GetHashCode();
                hashCode += 1000000007 * Age.GetHashCode();
                hashCode += 1000000009 * BaseProtection.GetHashCode();
                hashCode += 1000000021 * Protection.GetHashCode();
                hashCode += 1000000033 * BaseDamage.GetHashCode();
                hashCode += 1000000087 * Damage.GetHashCode();
                hashCode += 1000000093 * Experience.GetHashCode();
                if (Spells != null)
                {
                    hashCode += 1000000097 * Spells.GetHashCode();
                }
                if (Name != null)
                {
                    hashCode += 1000000103 * Name.GetHashCode();
                }
                if (SpellStrengths != null)
                {
                    hashCode += 1000000123 * SpellStrengths.GetHashCode();
                }
            }
            return(hashCode);
        }
예제 #32
0
    public override void Damage(BaseDamage damage,GameObject killer)
    {
        if (isSpawn) {//если только респавнились, то повреждений не получаем
            return;
        }

        Pawn killerPawn =killer.GetComponent<Pawn> ();
        if (killerPawn != null && killerPawn.team == team &&! PlayerManager.instance.frendlyFire) {
            return;
        }
        if (killerPawn != null){
            Player killerPlayer =  killerPawn.player;
            if(killerPlayer!=null){
                killerPlayer.DamagePawn(damage.Damage,damage.hitPosition);
            }
        }
        if (photonView.isMine) {
            AddEffect(damage.hitPosition);
            float forcePush =  charMan.GetFloatChar(CharacteristicList.STANDFORCE);
            ///Debug.Log(forcePush +" "+damage.pushForce);
            forcePush =damage.pushForce-forcePush;
            //Debug.Log(forcePush);
            if(forcePush>0){
                damage.pushDirection.y=0;
                AddPushForce(forcePush*damage.pushDirection*FORCE_MULIPLIER);

            }

        }
        if (!PhotonNetwork.isMasterClient){
            return;
        }
        if (isAi) {
            mainAi.WasHitBy(killer);

        }

        //Debug.Log ("DAMAGE");
        base.Damage(damage,killer);
    }
예제 #33
0
 public BaseDamage(BaseDamage old)
 {
     Damage    = old.Damage;
     isVsArmor = old.isVsArmor;
     pushForce = old.pushForce;
 }
예제 #34
0
    void Update()
    {
        playerSpeed = player.GetComponent <BB_BasicControls>().speed;

        GameObject go = GameObject.Find("Time_Canvas");

        // ONGOING TIME - TIMER : DAY : SEASON :-
        if (timerActive)
        {
            playButtonTxt.text = "Pause";
            time         += Time.deltaTime;
            timeOfDay    += Time.deltaTime;
            timeOfSeason += Time.deltaTime;
        }

        //  DISPLAY DATE - CALCULATING: DAYS

        calen       = time / wholeDaySeconds;
        datees      = Mathf.FloorToInt(calen + startDay);
        displayDate = Mathf.FloorToInt(datees);
        date.GetComponent <Text>().text = "Day " + displayDate.ToString();

        // SKIP X1
        if (skipActive)
        {
            time         = time + skipTime;
            timeOfDay    = timeOfDay + skipTime;
            timeOfSeason = timeOfSeason + skipTime;
            skipX2Active = false;
            playerSpeed  = 50;
            if (!skipX2Active)
            {
                skipX2ButtonTxt.text = "FFX2";
            }
        }

        // SKIP X2
        if (skipX2Active)
        {
            time         = time + skipTime * 2;
            timeOfDay    = timeOfDay + skipTime * 2;
            timeOfSeason = timeOfSeason + skipTime * 2;
            skipActive   = false;
            playerSpeed  = 250;
            if (!skipActive)
            {
                skipButtonTxt.text = "FF";
            }
        }
        // PLAYER SPEED
        if (!skipX2Active && !skipActive)
        {
            playerSpeed = 8;
        }

        // SHREEYA Additions :SHREEYA :- MINI BOSS DAMAGE

        if (displayDate == 100)
        {
            if (timeOfDay >= 20 && timeOfDay <= 21)
            {
                Debug.Log("dstroy");
                Damage();
            }

            // test = test + 1;
            // Debug.Log(test);
        }

        if (displayDate == 100)
        {
            BaseDamage.MiniBDamage();
        }


        // SPLITTING DAYS INTO :: YEARS AND DAYS :-

        if (displayDate > 100)
        {
            year        = Mathf.FloorToInt(displayDate / 100);
            displayDate = displayDate - 100;
            date.GetComponent <Text>().text = "Year " + year + "  Day " + displayDate.ToString();
        }

        // SEASON - NO OF SEASONS PASSED :
        if (timeOfSeason >= SeasonSeconds)
        {
            season       += 1;
            timeOfSeason -= SeasonSeconds;
        }

        // DAYS RESET TO 1 IF YEAR > 0
        if (timeOfDay >= wholeDaySeconds)
        {
            timeOfDay -= wholeDaySeconds;
        }

        // DAY :-
        if (timeOfDay <= wholeDaySeconds / 2)
        {
            if (timeOfDay >= 20 && timeOfDay <= 21)
            {
                BaseHealthObj.GetComponent <BaseHealth>().BaseHealthCalc();
            }

            DayText.SetActive(true);
            NightText.SetActive(false);
            timeBar.fillAmount = timeOfDay / Daymax;
            timevalue.text     = (timeBar.fillAmount * Daymax).ToString("F0");
            itsDay             = true;
        }
        // NIGHT :-
        if (timeOfDay >= wholeDaySeconds / 2)
        { // activate the code below once merged - NIYATI.
            if (timeOfDay >= 160 && timeOfDay <= 161)
            {
                CommonHappinessIndex.TimeToEat();
                CommonHappinessIndex.RecaclculateHappinessIndex();
                GameObject.Find("HappinessIndex Variant").GetComponent <FollowerLeaving>().updateFollowerLeaving();
            }

            NightText.SetActive(true);
            DayText.SetActive(false);
            float half = timeOfDay / 2;
            timeBar.fillAmount = half / Nightmax;
            timevalue.text     = (timeBar.fillAmount * Nightmax).ToString("F0");
            itsDay             = false;
        }
        // SPRING :-
        if (displayDate <= 25)
        {
            SeasonMeter.fillAmount = timeOfSeason / SeasonSeconds; // SEASON METER.

            seasonName.GetComponent <Text>().text = "Spring";
            Spring();
            if (harshWeather)
            {
                seasonName.GetComponent <Text>().text = "Spring - harsh";
            }
        }
        else
        {
            SpringUI.SetActive(false);
        }

        // SUMMER :-
        if (displayDate > 25)
        {
            SeasonMeter.fillAmount = timeOfSeason / SeasonSeconds;// SEASON METER.
            seasonName.GetComponent <Text>().text = "Summer";
            Summer();
            if (harshWeather)
            {
                seasonName.GetComponent <Text>().text = "Summer - harsh";
            }
        }
        else
        {
            SummerUI.SetActive(false);
        }

        // AUTUMN :-
        if (displayDate > 50)
        {
            SeasonMeter.fillAmount = timeOfSeason / SeasonSeconds;// SEASON METER.
            seasonName.GetComponent <Text>().text = "Autumn";
            Autumn();
            if (harshWeather)
            {
                seasonName.GetComponent <Text>().text = "Autumn- harsh";
            }
        }
        else
        {
            AutumnUI.SetActive(false);
        }

        // WINTER:-
        if (displayDate > 75)
        {
            SeasonMeter.fillAmount = timeOfSeason / SeasonSeconds;// SEASON METER.
            seasonName.GetComponent <Text>().text = "Winter";
            Winter();
            if (harshWeather)
            {
                seasonName.GetComponent <Text>().text = "Winter- harsh";
            }
        }
        else
        {
            WinterUI.SetActive(false);
        }
    }