Exemplo n.º 1
0
        protected override ValidationResult IsValid(object value, ValidationContext validationContext)
        {
            DMG dmgValue = (DMG)value;

            if (dmgValue == null)
            {
                return(new ValidationResult("DMG is required"));
            }
            string ErrorString = string.Empty;

            if (dmgValue.DMG1 != "D8")
            {
                ErrorString = "DMG01 should be D8 and required ";
            }
            ErrorString += ValidateElement.GetValidation(dmgValue.DMG2, Element.Required, 1, 35, "DMG02");
            if (!(dmgValue.DMG3 == "F" || dmgValue.DMG3 == "M" || dmgValue.DMG3 == "U"))
            {
                ErrorString += "DMG03 should be F,M,U";
            }
            if (ErrorString == string.Empty)
            {
                return(null);
            }
            return(new ValidationResult(ErrorString));
        }
Exemplo n.º 2
0
        // GET: AdminCP/DMG/Edit/5
        public ActionResult Edit(int?id, int?MaGV)
        {
            DMG dMG;

            if (id == null)
            {
                dMG = new DMG
                {
                    MaGV     = MaGV,
                    TongHeSo = 0,
                    TongDMG  = 0
                };
            }
            else
            {
                dMG = db.DMGs.Find(id);
                if (dMG == null)
                {
                    return(HttpNotFound());
                }
            }
            ViewBag.IDNamHocs = db.NamHocs.Where(q => q.Active != false).CreateSelectList(q => q.IDNamHoc, q => q.mNamHoc, dMG.IDNamHoc);
            ViewBag.MaHocHams = db.HocHams.Where(q => q.Active != false).CreateSelectList(q => q.MaHocHam, q => q.TenHocHam, dMG.MaHocHam);
            return(View(dMG));
        }
Exemplo n.º 3
0
 override public void DeductHealth(DMG dmg, AudioClip crit_sfx = null)
 {
     if (CurrHealth - dmg.Damage <= 0)
     {
         CurrHealth -= dmg.Damage;
         IC.UpdateHealthBar();
         IC.PopUpDmg(dmg);
         DieUpdate();
         return;
     }
     if (dmg.IsCrit)
     {
         Animator Anim = GetComponent <Animator>();
         Anim.SetFloat("PhysicsSpeedFactor", GetPhysicsSpeedFactor());
         Anim.Play("crit");
         if (crit_sfx != null)
         {
             AudioSource.PlayClipAtPoint(crit_sfx, transform.position, GameManager.SFX_Volume);
         }
     }
     else
     {
         AudioSource.PlayClipAtPoint(hit, transform.position, GameManager.SFX_Volume);
     }
     CurrHealth -= dmg.Damage;
     IC.UpdateHealthBar();
     IC.PopUpDmg(dmg);
 }
Exemplo n.º 4
0
        // POST: AdminCP/DMG/Delete/5
        public JsonResult Delete(int id)
        {
            DMG dMG = db.DMGs.Find(id);

            dMG.Active = false;
            return(Json(db.SaveChanges()));
        }
Exemplo n.º 5
0
        public void Start()
        {
            _dmgMain = new DMG();
            Logging.Log("Starting SharpBoy...", Severity.Information);

            _dmgMain.Init();
            Logging.Log("Initializing components...", Severity.Information);
            GameBoyWindow gbw = new GameBoyWindow();

            gbw.Init();
            Logging.Log("Creating GameBoy window...", Severity.Information);
            //_dmgMain.LoadROM(@"C:\Users\tkatt\Desktop\tetris.gb");

            while (gbw.gameboyWindow.IsOpen)
            {
                gbw.gameboyWindow.Clear();
                gbw.gameboyWindow.DispatchEvents();
                gbw.gameboyWindow.Display();

                /*
                 * if(_dmgMain.HasInstructionsLeft())
                 *  Tick();
                 */
            }
        }
Exemplo n.º 6
0
        ///<Summary>
        ///<CreatedOn>08/09/2017</CreatedOn>
        ///<Author>Sunny Bhardwaj</Author>
        ///<Description>Returns object for subscriber Demographics segment</Description>
        ///</Summary>
        public static DMG GetDMG(string DMG01, string DMG02, string DMG03)
        {
            DMG obj = new DMG();

            obj.DMG01 = DMG01;
            obj.DMG02 = DMG02; //CreateString(Convert.ToDateTime(DMG02).ToString("yyyyMMdd"), (int)SegmentLength.One, (int)SegmentLength.ThirtyFive, ' ', true);
            //obj.DMG03 = CreateString(DMG02, (int)SegmentLength.One, (int)SegmentLength.One, 'U', true);
            return(obj);
        }
Exemplo n.º 7
0
 void OnTriggerEnter2D(Collider2D collider)
 {
     if (collider.tag == "Player")
     {
         if (HittedStack.Count != 0 && HittedStack.Contains(collider))  //Prevent duplicated attacks
         {
             return;
         }
         PlayerController Player = collider.GetComponent <PlayerController>();
         DMG dmg = EC.AutoAttackDamageDeal(Player.CurrDefense);
         Player.DeductHealth(dmg);
         HittedStack.Push(collider);
     }
 }
Exemplo n.º 8
0
    //public methods
    public void PopUpDmg(DMG dmg)
    {
        GameObject PopUpText = Instantiate(Resources.Load("UIPrefabs/PopUpText"), transform) as GameObject;

        PopUpText.transform.localScale = new Vector3(2, 2, 1);
        float ExitTime = PopUpText.GetComponent <Animator>().GetCurrentAnimatorStateInfo(0).length;
        Text  PopText  = PopUpText.GetComponent <Text>();

        PopText.text = dmg.Damage.ToString("F0");
        if (dmg.IsCrit)
        {
            PopText.color    = Color.red;
            PopText.fontSize = 100;
        }
        Destroy(PopUpText, ExitTime);
    }
Exemplo n.º 9
0
 void OnCollisionEnter2D(Collision2D collision)
 {
     if (collision.transform.tag == "Enemy")
     {
         if (HittedStack.Count != 0 && HittedStack.Contains(collision.collider))  //Prevent duplicated attacks
         {
             return;
         }
         EnemyController Enemy = collision.collider.GetComponent <EnemyController>();
         DMG             dmg   = SkillDmg(Enemy.CurrDefense);
         Enemy.DeductHealth(dmg, Crit_SFX);
         HittedStack.Push(collision.collider);
     }
     else if (collision.transform.tag == "Player")
     {
     }
 }
Exemplo n.º 10
0
 void OnTriggerEnter2D(Collider2D collider)
 {
     if (collider.tag == "Enemy")
     {
         if (HittedStack.Count != 0 && HittedStack.Contains(collider))//Prevent duplicated attacks
         {
             return;
         }
         EnemyController Enemy = collider.GetComponent <EnemyController>();
         DMG             dmg   = PC.AutoAttackDamageDeal(Enemy.CurrDefense);
         Enemy.DeductHealth(dmg, WC.crit);
         HittedStack.Push(collider);
     }
     else if (collider.tag == "Player")
     {
     }
 }
Exemplo n.º 11
0
 public ActionResult Edit(DMG obj)
 {
     if (obj.MaDMG > 0)
     {
         db.Entry(obj).State = EntityState.Modified;
     }
     else
     {
         db.DMGs.Add(obj);
     }
     obj.TongHeSo = db.CT_DMG.Where(q => q.MaDMG == obj.MaDMG).Sum(q => q.ChucVu.HeSo) ?? 0;
     if (obj?.TongHeSo > 50)
     {
         obj.TongHeSo = 50;
     }
     obj.TongDMG = db.HocHams.Find(obj.MaHocHam).DMG ?? 0;
     db.SaveChanges();
     return(RedirectToAction("Detail", "GV", new { id = obj.MaGV, tab = 3 }));
 }
Exemplo n.º 12
0
    //Unique Methods

    DMG SkillDmg(float TargetDefense)
    {
        DMG dmg = new DMG();

        if (Random.value < (PC.CurrCritChance / 100))
        {
            dmg.Damage += PC.CurrAD * (ADScale / 100) * (PC.CurrCritDmgBounus / 100);
            dmg.IsCrit  = true;
        }
        else
        {
            dmg.Damage += PC.CurrAD * (ADScale / 100);
            dmg.IsCrit  = false;
        }
        float reduced_dmg = dmg.Damage * (TargetDefense / 100);

        dmg.Damage = dmg.Damage - reduced_dmg;
        PC.GenerateLPHMPH();
        return(dmg);
    }
Exemplo n.º 13
0
 void OnTriggerEnter2D(Collider2D collider)
 {
     if (collider.tag == "Enemy")
     {
         if (HittedStack.Count != 0 && HittedStack.Contains(collider))  //Prevent duplicated attacks
         {
             return;
         }
         EnemyController Enemy             = collider.GetComponent <EnemyController>();
         Vector2         BouceOffDirection = (Vector2)Vector3.Normalize(Enemy.transform.position - PC.transform.position);
         Enemy.rb.mass = 1;
         Enemy.rb.AddForce(BouceOffDirection * SkillData.lvl * 2, ForceMode2D.Impulse);
         DMG dmg = SkillDmg(Enemy.CurrDefense);
         Enemy.DeductHealth(dmg, Crit_SFX);
         HittedStack.Push(collider);
     }
     else if (collider.transform.tag == "Player")
     {
     }
 }
Exemplo n.º 14
0
    //----------public

    //Combat
    override public DMG AutoAttackDamageDeal(float TargetDefense)
    {
        DMG dmg = new DMG();

        if (Random.value < (CurrCritChance / 100))
        {
            dmg.Damage += CurrAD * (CurrCritDmgBounus / 100);
            dmg.Damage += CurrMD * (CurrCritDmgBounus / 100);
            dmg.IsCrit  = true;
        }
        else
        {
            dmg.Damage = CurrAD + CurrMD;
            dmg.IsCrit = false;
        }
        float reduced_dmg = dmg.Damage * (TargetDefense / 100);

        dmg.Damage = dmg.Damage - reduced_dmg;
        GenerateLPHMPH();
        return(dmg);
    }
Exemplo n.º 15
0
 virtual public void DeductHealth(DMG dmg, AudioClip crit_sfx = null)
 {
 }
Exemplo n.º 16
0
        private void buttonDMGcalc_Click(object sender, EventArgs e)
        {
            //如果沒有輸入的狀況
            if (textBoxBaseATK.Text == "")
            {
                textBoxBaseATK.Text = "0";
            }
            if (textBoxItemATK.Text == "")
            {
                textBoxItemATK.Text = "0";
            }
            if (textBoxSkillMut.Text == "")
            {
                textBoxSkillMut.Text = "1";
            }

            int BaseATK = Int32.Parse(textBoxBaseATK.Text);
            int ItemATK = Int32.Parse(textBoxItemATK.Text);

            float BuffATK = stoPercent(textBoxBuffATK.Text);
            float CritDMG;
            float BuffSkillDMG = stoPercent(textBoxBuffSkillDMG.Text);
            float BuffBossDMG  = stoPercent(textBoxBuffBossDMG.Text);

            float SkillMut = float.Parse(textBoxSkillMut.Text);

            float  Weak = 1, HP2div1 = 1;
            double DMG;

            if (checkBoxWeak.Checked)
            {
                Weak = 1.5f;
            }
            if (checkBoxHP2div1.Checked)
            {
                HP2div1 = 1.5f;
            }
            if (checkBoxCrit.Checked)
            {
                CritDMG = stoPercent(textBoxCritDMG.Text);
            }
            else
            {
                CritDMG = 1;
            }

            DMG = ((BaseATK * BuffATK + ItemATK) / 2 * CritDMG * BuffSkillDMG * BuffBossDMG * Weak * HP2div1 * SkillMut * 1.05f);

            if (numericUpDownCharacterDMG.Text == "")
            {
                numericUpDownCharacterDMG.Text = "0";
            }
            char chara = (numericUpDownCharacterDMG.Text)[0];

            string couttextDMG = DMG.ToString("N");

            switch (chara)
            {
            case '1':
                labelS1_1.Text = couttextDMG;
                break;

            case '2':
                labelS2_2.Text = couttextDMG;
                break;

            case '3':
                labelS3_3.Text = couttextDMG;
                break;

            case '4':
                labelS4_4.Text = couttextDMG;
                break;

            case '5':
                labelS5_5.Text = couttextDMG;
                break;

            default:
                MessageBox.Show("Character must be 1~5\n");
                break;
            }
        }