public virtual AttackState Attack(ManageDungeon dun, BaseCharacter target, BaseCharacter attacker, int power, AttackInformation atinf) { int damage = 0; atinf.AddTarget(target); //声を鳴らす atinf.AddVoice(attacker.VoiceAttack()); //攻撃の命中判定 if (CommonFunction.IsRandom(WeaponDexterity) == true) { //行動タイプを設定 atinf.SetBehType(BehaviorType.Attack); //命中したら atinf.AddHit(target, true); //声を鳴らす atinf.AddVoice(target.VoiceDefence()); //サウンドを鳴らす atinf.AddSound(GetAttackHitSound()); BaseOption[] atoptions = attacker.Options; BaseOption[] tgoptions = target.Options; //与ダメージを計算 damage = CalcDamage(dun, attacker, target, power, atoptions, tgoptions, 1); //スコア関連値の更新 if (target.Type == ObjectType.Enemy) { TotalDamage += damage; if (ScoreInformation.Info.MostUseWeaponDamage < TotalDamage) { ScoreInformation.Info.MostUseWeaponDamage = TotalDamage; ScoreInformation.Info.MostUseWeaponName = DisplayNameNormal; } ScoreInformation.Info.AddScore(damage); } //atinf.AddDamage(target.Name, damage); ////ヒットメッセージ //atinf.AddMessage( // target.GetMessageAttackHit(this.DisplayNameInMessage, damage)); ////ダメージ判定 //AttackState atState = target.AddDamage(damage); //ダメージ追加 AttackState atState = CommonFunction.AddDamage(atinf, attacker, target, damage); //ガラスアイテム判定 WeaponBase atw = attacker.EquipWeapon; foreach (BaseOption op in atw.Options) { if (op.IsBreak() == true) { atinf.AddSound(SoundInformation.SoundType.Break); atinf.AddMessage( string.Format(CommonConst.Message.BreakItem, atw.DisplayNameInMessage)); atw.ForceRemoveEquip(attacker); PlayerCharacter.RemoveItem(atw); } } ShieldBase tgs = target.EquipShield; foreach (BaseOption op in tgs.Options) { if (op.IsBreak() == true) { atinf.AddSound(SoundInformation.SoundType.Break); atinf.AddMessage( string.Format(CommonConst.Message.BreakItem, tgs.DisplayNameInMessage)); tgs.ForceRemoveEquip(target); PlayerCharacter.RemoveItem(tgs); } } //対象が死亡したら if (atState == AttackState.Death) { atinf.AddKillList(target); atinf.AddMessage( target.GetMessageDeath(target.HaveExperience)); } else { //atinf.IsDeath.Add(target.Name, false); addabnormal.Clear(); prevents.Clear(); foreach (StateAbnormal val in CommonFunction.StateAbnormals) { prevents.Add(val, 0); addabnormal.Add(val, AddAbnormalProb[val]); } int opab = 0; //オプションの付加値設定 foreach (BaseOption o in atoptions) { int ab = o.SetAbnormalAttack(addabnormal); opab = opab | ab; } int tarabn = AddAbnormal | opab; if (tarabn != 0) { //オプションによる状態異常の取得 //foreach (StateAbnormal val in CommonFunction.StateAbnormals) //{ // addabnormal.Add(val, 0); //} //オプションの抵抗値設定 foreach (BaseOption o in tgoptions) { o.SetAbnormalPrevent(prevents); } int abn = 0; //状態異常の付与 foreach (StateAbnormal val in CommonFunction.StateAbnormals) { int abnormal = (int)val & tarabn; //対象の状態異常を処理 if (abnormal != 0) { //float prob = prevents[val] > AddAbnormalProb[val] ? prevents[val] : AddAbnormalProb[val]; //状態異常付与が成功したとき if (CommonFunction.IsRandom(addabnormal[val]) == true) { //抵抗に成功したとき if (CommonFunction.IsRandom(prevents[val]) == true) { } else { int addstate = target.AddStateAbnormal(abnormal); if (addstate != 0) { abn += abnormal; //atinf.AddAbnormal(target, abnormal); atinf.AddMessage( CommonFunction.GetAbnormalMessage(val, target)); } } } } } if (abn != 0) { atinf.AddEffect(EffectBadSmoke.CreateObject(target)); atinf.AddAbnormal(target, abn); } } } //エフェクトをかける this.AttackEffect(target, attacker, damage.ToString(), AttackState.Hit, atinf); return(atState); } else { //外れた場合 atinf.AddHit(target, false); EffectDamage d = EffectDamage.CreateObject(target); d.SetText("Miss", AttackState.Miss); atinf.AddEffect(d); atinf.AddSound(GetAttackMissSound()); atinf.AddMessage( target.GetMessageAttackMiss()); return(AttackState.Miss); } }