Esempio n. 1
0
 public void InitSpell(float _power, float _scatter, Transform caster, damage_type type)
 {
     power       = _power;
     damage_type = type;
     t           = caster;
     scatter     = _scatter;
 }
Esempio n. 2
0
    public void ApplyDmg(float dmg, damage_type type)
    {
        float dm = dmg * (25 / stats.armor);

        if (dm < dmg * 0.05f)
        {
            dm = dmg * 0.05f;
        }
        health -= dm;
    }
 public bool DeleteDamageType(long damage_type_id)
 {
     try
     {
         damage_type objDamageType = _entities.damage_type.FirstOrDefault(c => c.damage_type_id == damage_type_id);
         _entities.damage_type.Attach(objDamageType);
         _entities.damage_type.Remove(objDamageType);
         _entities.SaveChanges();
         return(true);
     }
     catch (Exception)
     {
         return(false);
     }
 }
Esempio n. 4
0
	public Skill (string unique, int _class, int lvl, string name, string desc, damage_type dmgType, damage_effect dmgEffect, element e, int turnM, int dm, int mpC, int hpC = 0){
		unique = uName;
		reqClass = _class;
		dType = dmgType;
		dEffect = dmgEffect;
		turnMod = turnM;
		_name = name;
		_desc = desc;
		dmg = dm;
		hpCost = hpC;
		mpCost = mpC;
		level = lvl;
		el = e;

	}
Esempio n. 5
0
        public HttpResponseMessage Post([FromBody] Models.damage_type objDamageType)
        {
            try
            {
                if (string.IsNullOrEmpty(objDamageType.damage_type_name))
                {
                    var formatter = RequestFormat.JsonFormaterString();
                    return(Request.CreateResponse(HttpStatusCode.OK, new Confirmation {
                        output = "error", msg = "Damage Type  Name is Empty"
                    }, formatter));
                }

                else
                {
                    if (damageTypeRepository.CheckDuplicateDamageTypeName(objDamageType.damage_type_name) == true)
                    {
                        var formatter = RequestFormat.JsonFormaterString();
                        return(Request.CreateResponse(HttpStatusCode.OK, new Confirmation {
                            output = "error", msg = "Damage Type  Already Exists"
                        }, formatter));
                    }
                    else
                    {
                        damage_type insertDamageType = new damage_type
                        {
                            damage_type_name = objDamageType.damage_type_name,
                            created_by       = objDamageType.created_by,
                            created_date     = DateTime.Now,
                            is_active        = true,
                            updated_by       = objDamageType.updated_by,
                            updated_date     = objDamageType.updated_date,
                        };
                        bool save      = damageTypeRepository.InsertDamageType(insertDamageType);
                        var  formatter = RequestFormat.JsonFormaterString();
                        return(Request.CreateResponse(HttpStatusCode.OK, new Confirmation {
                            output = "success", msg = "Damage Type save successfully"
                        }, formatter));
                    }
                }
            }
            catch (Exception ex)
            {
                var formatter = RequestFormat.JsonFormaterString();
                return(Request.CreateResponse(HttpStatusCode.OK, new Confirmation {
                    output = "error", msg = ex.ToString()
                }, formatter));
            }
        }
Esempio n. 6
0
    public void Init_Attack(skill_type _st, float _dmg, float _scatter,
                            float LifeSpan, Transform _caster, Collider2D collider, damage_type dmg_type)
    {
        st      = _st;
        dmg     = _dmg;
        t       = _caster;
        scatter = _scatter;
        if (st != skill_type.spell)
        {
            StartCoroutine(Sleep_after(LifeSpan));
        }
        type = dmg_type;

        Debug.Log("cll " + collider + " " + name);
        Physics2D.IgnoreCollision(GetComponent <Collider2D>(), collider);
    }
 public bool UpdateDamageType(damage_type oDamageType)
 {
     try
     {
         damage_type ci = _entities.damage_type.Find(oDamageType.damage_type_id);
         ci.damage_type_name = oDamageType.damage_type_name;
         ci.updated_by       = oDamageType.updated_by;
         ci.updated_date     = oDamageType.updated_date;
         ci.is_active        = oDamageType.is_active;
         _entities.SaveChanges();
         return(true);
     }
     catch (Exception)
     {
         return(false);
     }
 }
Esempio n. 8
0
        public HttpResponseMessage Put([FromBody] Models.damage_type objDamageType)
        {
            try
            {
                if (string.IsNullOrEmpty(objDamageType.damage_type_name))
                {
                    var formatter = RequestFormat.JsonFormaterString();
                    return(Request.CreateResponse(HttpStatusCode.OK, new Confirmation {
                        output = "error", msg = "DamageType Name is Empty"
                    }, formatter));
                }

                else
                {
                    damage_type insertDamageType = new damage_type

                    {
                        damage_type_id   = objDamageType.damage_type_id,
                        damage_type_name = objDamageType.damage_type_name,
                        is_active        = objDamageType.is_active,
                        updated_by       = objDamageType.updated_by,
                        updated_date     = DateTime.Now
                    };

                    bool irepoUpdate = damageTypeRepository.UpdateDamageType(insertDamageType);

                    var formatter = RequestFormat.JsonFormaterString();
                    return(Request.CreateResponse(HttpStatusCode.OK, new Confirmation {
                        output = "success", msg = "Damage Type Update successfully"
                    }, formatter));
                }
            }
            catch (Exception ex)
            {
                var formatter = RequestFormat.JsonFormaterString();
                return(Request.CreateResponse(HttpStatusCode.OK, new Confirmation {
                    output = "error", msg = ex.ToString()
                }, formatter));
            }
        }
 public bool InsertDamageType(damage_type oDamageType)
 {
     try
     {
         damage_type insert_damage_type = new damage_type
         {
             damage_type_name = oDamageType.damage_type_name,
             created_by       = oDamageType.created_by,
             created_date     = oDamageType.created_date,
             updated_by       = oDamageType.updated_by,
             updated_date     = oDamageType.updated_date,
             is_active        = oDamageType.is_active,
             is_deleted       = false
         };
         _entities.damage_type.Add(insert_damage_type);
         _entities.SaveChanges();
         return(true);
     }
     catch (Exception)
     {
         return(false);
     }
 }