Example #1
0
 private void SetNewSurfaceRule(SurfaceAffectEventArgs e)
 {
     switch (HumanoidRace)
     {
         case HumanoidRace.Dwarf:
             switch (e.surfaceType)
             {
                 case ITGame.CLI.Models.Environment.SurfaceType.Ground:
                     ApplySurfaceRule(e.actionRule, bonus: true, bonusRate: 1.2);
                     break;
                 case ITGame.CLI.Models.Environment.SurfaceType.Water:
                     ApplySurfaceRule(e.actionRule, bonus: true, bonusRate: 0.2);
                     break;
                 case ITGame.CLI.Models.Environment.SurfaceType.Lava:
                     ApplySurfaceRule(e.actionRule, bonus: false, bonusRate: 0.8);
                     break;
                 case ITGame.CLI.Models.Environment.SurfaceType.Swamp:
                     ApplySurfaceRule(e.actionRule, bonus: false, bonusRate: 0.6);
                     break;
                 default:
                     break;
             }
             break;
         case HumanoidRace.Elf:
             switch (e.surfaceType)
             {
                 case ITGame.CLI.Models.Environment.SurfaceType.Ground:
                     ApplySurfaceRule(e.actionRule, bonus: true);
                     break;
                 case ITGame.CLI.Models.Environment.SurfaceType.Water:
                     ApplySurfaceRule(e.actionRule, bonus: true);
                     break;
                 case ITGame.CLI.Models.Environment.SurfaceType.Lava:
                     ApplySurfaceRule(e.actionRule, bonus: false, bonusRate: 1.5);
                     break;
                 case ITGame.CLI.Models.Environment.SurfaceType.Swamp:
                     ApplySurfaceRule(e.actionRule, bonus: false);
                     break;
                 default:
                     break;
             }
             break;
         case HumanoidRace.Human:
             switch (e.surfaceType)
             {
                 case ITGame.CLI.Models.Environment.SurfaceType.Ground:
                     ApplySurfaceRule(e.actionRule, bonus: true);
                     break;
                 case ITGame.CLI.Models.Environment.SurfaceType.Water:
                     ApplySurfaceRule(e.actionRule, bonus: true, bonusRate: 0.5);
                     break;
                 case ITGame.CLI.Models.Environment.SurfaceType.Lava:
                     ApplySurfaceRule(e.actionRule, bonus: false);
                     break;
                 case ITGame.CLI.Models.Environment.SurfaceType.Swamp:
                     ApplySurfaceRule(e.actionRule, bonus: false, bonusRate: 0.5);
                     break;
                 default:
                     break;
             }
             break;
         case HumanoidRace.Orc:
             switch (e.surfaceType)
             {
                 case ITGame.CLI.Models.Environment.SurfaceType.Ground:
                     ApplySurfaceRule(e.actionRule, bonus: true);
                     break;
                 case ITGame.CLI.Models.Environment.SurfaceType.Water:
                     ApplySurfaceRule(e.actionRule, bonus: false);
                     break;
                 case ITGame.CLI.Models.Environment.SurfaceType.Lava:
                     ApplySurfaceRule(e.actionRule, bonus: false, bonusRate: 0.8);
                     break;
                 case ITGame.CLI.Models.Environment.SurfaceType.Swamp:
                     ApplySurfaceRule(e.actionRule, bonus: true);
                     break;
                 default:
                     break;
             }
             break;
         default:
             break;
     }
 }
Example #2
0
 protected abstract void OnSurfaceChangedHandler(object sender, SurfaceAffectEventArgs e);
Example #3
0
        protected override void OnSurfaceChangedHandler(object sender, SurfaceAffectEventArgs e)
        {
            if (e.surfaceType == _lastSurfaceType) return;//могут ли сюда прийти новые правила для старой поверхности?

            OnActionPerformed(new ActionPerformedEventArgs(
                string.Format("Oh, look at this, {0}. Surface was changed to {1}", Name, e.surfaceType),
                ActionType.Info)
                );

            RemoveOldSurfaceBonus();

            _lastSurfaceRule = e.actionRule;
            _lastSurfaceType = e.surfaceType;

            SetNewSurfaceRule(e);
        }