{"id":1646,"date":"2019-11-13T08:51:41","date_gmt":"2019-11-12T23:51:41","guid":{"rendered":"http:\/\/taki-lab.site\/bocci\/?p=1646"},"modified":"2019-11-13T08:51:44","modified_gmt":"2019-11-12T23:51:44","slug":"%e3%80%90%e3%83%97%e3%83%ad%e3%82%b0%e3%83%a9%e3%83%9f%e3%83%b3%e3%82%b0%e3%80%91%e5%8b%87%e8%80%85%e3%81%a8%e9%ad%94%e7%8e%8b%e3%81%ae%e6%88%a6%e3%81%84","status":"publish","type":"post","link":"https:\/\/taki-lab.site\/bocci\/?p=1646","title":{"rendered":"\u3010\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u3011\u52c7\u8005\u3068\u9b54\u738b\u306e\u6226\u3044"},"content":{"rendered":"\n<p>Tech commit\u306e\u8ab2\u984c\u3067\u3001\u9762\u767d\u305d\u3046\u306a\u30c6\u30fc\u30de\u3060\u3063\u305f\u306e\u3067\u3001\u6311\u6226\u3057\u3066\u307f\u307e\u3057\u305f\u3002<\/p>\n\n\n\n<p><a href=\"https:\/\/github.com\/takishita2nd\/battle_rpg\">https:\/\/github.com\/takishita2nd\/battle_rpg<\/a><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>\u52c7\u8005\u3068\u9b54\u738b\u304c\u4ea4\u4e92\u306b\u653b\u6483\u3059\u308b<\/li><li>\u4e00\u5b9a\u78ba\u7387\u3067\u653b\u6483\u3092\u56de\u907f\u3059\u308b<\/li><li>\u4e00\u5b9a\u78ba\u7387\u3067\u30af\u30ea\u30c6\u30a3\u30ab\u30eb\u30d2\u30c3\u30c8\uff08\u30c0\u30e1\u30fc\u30b81.5\u500d\uff09\u306b\u306a\u308b<\/li><li>\u3069\u3063\u3061\u304c\u52dd\u5229\u3057\u305f\u304b\u3092\u8868\u793a\u3059\u308b<\/li><\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>using System;\n\nnamespace battle_rpg\n{\n    public static class Common\n    {\n        public static bool roleJudge(int rate)\n        {\n            bool judge = false;\n            Random r = new Random();\n            int value = r.Next(0, 100);\n            if(value &lt; rate) {\n                judge = true;\n            }\n            return judge;\n        }\n    }\n}<\/code><\/pre>\n\n\n\n<p>\u3053\u308c\u306f\u4e71\u6570\u3092\u4f7f\u3063\u3066\u3001\u547d\u4e2d\u3084\u30af\u30ea\u30c6\u30a3\u30ab\u30eb\u5224\u5b9a\u306a\u3069\u306e\u78ba\u7387\u5224\u5b9a\u3092\u884c\u3046\u30e1\u30bd\u30c3\u30c9\u3067\u3059\u3002<\/p>\n\n\n\n<p>\u5f15\u6570\u306b\u78ba\u7387(%)\u3092\u53d7\u3051\u53d6\u308a\u3001\u4e71\u6570\u30920\u301c100\u306e\u7bc4\u56f2\u3067\u767a\u751f\u3055\u305b\u3066\u3001\u305d\u306e\u5024\u304c\u78ba\u7387\u4ee5\u4e0b\u306a\u3089\u3070true\u3092\u8fd4\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>using System;\n\nnamespace battle_rpg\n{\n    public class Charactor\n    {\n        private const String Statusformat = \"{0}\uff1aHP{1} \u653b\u6483\u529b{2}\";\n        private const String AttackFormat = \"{0}\u306e\u653b\u6483\uff01{1}\u306b{2}\u306e\u30c0\u30e1\u30fc\u30b8\";\n        private const String CriticalAttackFormat = \"{0}\u306e\u653b\u6483\uff01\u30af\u30ea\u30c6\u30a3\u30ab\u30eb\u30d2\u30c3\u30c8\uff01{1}\u306b{2}\u306e\u30c0\u30e1\u30fc\u30b8\";\n        private const String EvasionFormat = \"{0}\u306e\u653b\u6483\uff01{1}\u306f\u653b\u6483\u3092\u304b\u308f\u3057\u305f\";\n        public string Name {get;}\n        public int Hp {get; set;}\n        public int Attack {get;}\n        public int evasionRate { get;}\n        public int criticalRate { get;}\n\n        public Charactor(string _name, int _hp, int _attack)\n        {\n            this.Name = _name;\n            this.Hp = _hp;\n            this.Attack = _attack;\n            this.evasionRate = 5;\n            this.criticalRate = 5;\n        }\n\n        \/**\n         * \u30bf\u30fc\u30b2\u30c3\u30c8\u3092\u653b\u6483\n         * &lt;param>  _target \u653b\u6483\u5bfe\u8c61\n         * &lt;return> \u4e0e\u3048\u305f\u30c0\u30e1\u30fc\u30b8\n         *\/\n        public String doAttack(Charactor _target)\n        {\n            String message = String.Empty;\n            if(isHit(_target)) {\n                int damage = this.Attack;\n                if(isCritical()) {\n                    damage = (int)(damage * 1.5);\n                    message = String.Format(CriticalAttackFormat, this.Name, _target.Name, damage);\n                } else {\n                    message = String.Format(AttackFormat, this.Name, _target.Name, damage);\n                }\n                _target.Hp -= damage;\n            } else {\n                message = String.Format(EvasionFormat, this.Name, _target.Name);\n            }\n\n            return message;\n        }\n\n        \/**\n         * \u547d\u4e2d\u5224\u5b9a\n         * &lt;param>  _target \u653b\u6483\u5bfe\u8c61\n         * &lt;return> true:\u547d\u4e2d\n         *\/\n        private bool isHit(Charactor _target)\n        {\n            bool hit = true;\n            if(Common.roleJudge(_target.evasionRate)) {\n                hit = false;\n            }\n            return hit;\n        }\n\n        \/**\n         * \u30af\u30ea\u30c6\u30a3\u30ab\u30eb\u5224\u5b9a\n         * &lt;return> true:\u30af\u30ea\u30c6\u30a3\u30ab\u30eb\n         *\/\n        private bool isCritical()\n        {\n            bool critical = false;\n            if(Common.roleJudge(this.criticalRate)) {\n                critical = true;\n            }\n            return critical;\n        }\n\n        \/**\n         * \u6b7b\u4ea1\u5224\u5b9a\n         * &lt;return> true:\u6b7b\u4ea1\n         *\/\n        public bool isDie()\n        {\n            bool die = false;\n            if(this.Hp &lt;= 0) {\n                die = true;\n            }\n            return die;\n        }\n\n        public String showStatus()\n        {\n            return String.Format(Statusformat, this.Name, this.Hp, this.Attack);\n        }\n    }\n}<\/code><\/pre>\n\n\n\n<p>\u52c7\u8005\u3084\u9b54\u738b\u3092\u6271\u3046\u30af\u30e9\u30b9\u3067\u3059\u3002<\/p>\n\n\n\n<p>\u3053\u306e\u30af\u30e9\u30b9\u306e\u4e2d\u3067HP\u3084\u653b\u6483\u529b\u306a\u3069\u3092\u4fdd\u6301\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u30e1\u30a4\u30f3\u306fdoAttack()\u30e1\u30bd\u30c3\u30c9\u3002\u3053\u306e\u4e2d\u3067\u547d\u4e2d\u5224\u5b9a\u3084\u30af\u30ea\u30c6\u30a3\u30ab\u30eb\u5224\u5b9a\u3092\u304a\u3053\u306a\u3044\u3001\u653b\u6483\u5bfe\u8c61(\u5f15\u6570)\u306eHP\u3092\u6e1b\u3089\u3057\u3066\u3044\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>using System;\n\nnamespace battle_rpg\n{\n    public class Battle\n    {\n        private Charactor yusha;\n        private Charactor maou;\n        private const String DieFormat = \"{0}\u306f\u5012\u308c\u305f\u3002\";\n        public Battle()\n        {\n            yusha = new Charactor(\"\u52c7\u8005\", 300, 15);\n            maou = new Charactor(\"\u9b54\u738b\", 400, 9);\n        }\n\n        public void execute()\n        {\n            bool nowBattle = true;\n            while(nowBattle) {\n                \/\/ HP\u8868\u793a\n                Console.WriteLine(yusha.showStatus());\n                Console.WriteLine(maou.showStatus());\n                Console.WriteLine();\n\n                \/\/ \u52c7\u8005\u306e\u653b\u6483\n                Console.WriteLine(yusha.doAttack(maou));\n\n                \/\/ \u9b54\u738b\u6b7b\u4ea1\u5224\u5b9a\n                if(maou.isDie()) {\n                    Console.WriteLine();\n                    Console.WriteLine(DieFormat, maou.Name);\n                    nowBattle = false;\n                    Console.WriteLine(\"\u4e16\u754c\u306b\u5e73\u548c\u304c\u8a2a\u308c\u305f\u3002\");\n                }\n\n                if(nowBattle == false) {\n                    return;\n                }\n\n                \/\/ \u9b54\u738b\u306e\u653b\u6483\n                Console.WriteLine(maou.doAttack(yusha));\n\n                \/\/ \u52c7\u8005\u6b7b\u4ea1\u5224\u5b9a\n                if(yusha.isDie()) {\n                    Console.WriteLine();\n                    Console.WriteLine(DieFormat, yusha.Name);\n                    nowBattle = false;\n                    Console.WriteLine(\"\u4e16\u754c\u306f\u5f81\u670d\u3055\u308c\u305f\u3002\");\n                }\n                Console.WriteLine();\n            }\n        }\n    } \n}<\/code><\/pre>\n\n\n\n<p>\u5b9f\u969b\u306b\u30d0\u30c8\u30eb\u3092\u884c\u3046\u30af\u30e9\u30b9\u3067\u3059\u3002<\/p>\n\n\n\n<p>\u30b3\u30f3\u30b9\u30c8\u30e9\u30af\u30bf\u3067\u52c7\u8005\u3068\u9b54\u738b\u306e\u30b9\u30c6\u30fc\u30bf\u30b9\u3092\u8a2d\u5b9a\u3001execute()\u3067\u3069\u3061\u3089\u304b\u304c\u8ca0\u3051\u308b\u307e\u3067\u30eb\u30fc\u30d7\u3092\u884c\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>using System;\n\nnamespace battle_rpg\n{\n    class Program\n    {\n        static void Main(string[] args)\n        {\n            Battle battle = new Battle();\n            battle.execute();\n        }\n    }\n}<\/code><\/pre>\n\n\n\n<p>\u30e1\u30a4\u30f3\u95a2\u6570\u3002Battle\u30af\u30e9\u30b9\u3092\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u5316\u3057\u3066execute()\u3092\u5b9f\u884c\u3057\u3066\u3044\u308b\u3060\u3051\u3067\u3059\u3002<\/p>\n\n\n\n<p>\u3068\u308a\u3042\u3048\u305a\u3001\u3053\u3093\u306a\u611f\u3058\u3067\u8981\u6c42\u3055\u308c\u3066\u3044\u308b\u51e6\u7406\u306f\u3067\u304d\u307e\u3057\u305f\u3002<\/p>\n\n\n\n<p>\u30ab\u30b9\u30bf\u30de\u30a4\u30ba\u3059\u308c\u3070\u8272\u3005\u3068\u62e1\u5f35\u3067\u304d\u305d\u3046\u3067\u3059\u306d\u3002<\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Tech commit\u306e\u8ab2\u984c\u3067\u3001\u9762\u767d\u305d\u3046\u306a\u30c6\u30fc\u30de\u3060\u3063\u305f\u306e\u3067\u3001\u6311\u6226\u3057\u3066\u307f\u307e\u3057\u305f\u3002 https:\/\/github.com\/takishita2nd\/battle_rpg \u52c7\u8005\u3068\u9b54\u738b\u304c\u4ea4\u4e92\u306b\u653b\u6483\u3059\u308b \u4e00\u5b9a\u78ba\u7387\u3067\u653b\u6483\u3092\u56de\u907f\u3059\u308b  &hellip; <a href=\"https:\/\/taki-lab.site\/bocci\/?p=1646\" class=\"more-link\">\u7d9a\u304d\u3092\u8aad\u3080 <span class=\"screen-reader-text\">\u3010\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u3011\u52c7\u8005\u3068\u9b54\u738b\u306e\u6226\u3044<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_uf_show_specific_survey":0,"_uf_disable_surveys":false,"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"\u3010\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u3011\u52c7\u8005\u3068\u9b54\u738b\u306e\u6226\u3044\n#Techcommit","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[3],"tags":[137,136],"class_list":["post-1646","post","type-post","status-publish","format-standard","hentry","category-3","tag-c","tag-136"],"aioseo_notices":[],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p8SDbY-qy","jetpack-related-posts":[{"id":2122,"url":"https:\/\/taki-lab.site\/bocci\/?p=2122","url_meta":{"origin":1646,"position":0},"title":"\u3010C#\u3011\u3010\u6570\u72ec\u3011\u30de\u30b9\u76ee\u306e\u30c7\u30fc\u30bf\u3092\u3069\u3046\u6301\u3064\u304b\u3001\u3092\u8003\u3048\u308b\u3002","author":"taki","date":"2020\u5e741\u670813\u65e5","format":false,"excerpt":"\u524d\u56de\u306e\u72b6\u6cc1\u306f\u3053\u3061\u3089\u3002 https:\/\/taki-lab.site\/bocci\/?p=2114 \u6700\u65b0\u30bd\u2026","rel":"","context":"C#","block_context":{"text":"C#","link":"https:\/\/taki-lab.site\/bocci\/?cat=174"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/taki-lab.site\/bocci\/wp-content\/uploads\/2020\/01\/7bafa34b531346adbdc8117bcf18057e.jpg?resize=350%2C200","width":350,"height":200},"classes":[]},{"id":2752,"url":"https:\/\/taki-lab.site\/bocci\/?p=2752","url_meta":{"origin":1646,"position":1},"title":"\u3010C#\u3011\u3010ALTSEED\u3011\u3010\u6570\u72ec\u3011\u89e3\u6790\u524d\u306e\u5165\u529b\u30c7\u30fc\u30bf\u306b\u8aa4\u308a\u304c\u3042\u3063\u305f\u5834\u5408\u306e\u5bfe\u51e6","author":"taki","date":"2020\u5e744\u670828\u65e5","format":false,"excerpt":"\u524d\u56de\u307e\u3067\u306e\u72b6\u6cc1\u306f\u3053\u3061\u3089\u3002 https:\/\/taki-lab.site\/bocci\/?p=2741 \u6700\u2026","rel":"","context":"C#","block_context":{"text":"C#","link":"https:\/\/taki-lab.site\/bocci\/?cat=174"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/taki-lab.site\/bocci\/wp-content\/uploads\/2020\/01\/ac15c7bfbcb71ae0137aba3065984908.jpg?resize=350%2C200","width":350,"height":200},"classes":[]},{"id":3288,"url":"https:\/\/taki-lab.site\/bocci\/?p=3288","url_meta":{"origin":1646,"position":2},"title":"\u3010\u5317\u6d77\u9053\u5927\u6226\u3011\u30de\u30c3\u30d7\u306b\u5e02\u753a\u6751\u540d\u3092\u8868\u793a\u3059\u308b","author":"taki","date":"2020\u5e746\u670814\u65e5","format":false,"excerpt":"\u524d\u56de\u307e\u3067\u306e\u72b6\u6cc1\u306f\u3053\u3061\u3089\u3002 https:\/\/taki-lab.site\/bocci\/?p=3250 g\u2026","rel":"","context":"C#","block_context":{"text":"C#","link":"https:\/\/taki-lab.site\/bocci\/?cat=174"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":2164,"url":"https:\/\/taki-lab.site\/bocci\/?p=2164","url_meta":{"origin":1646,"position":3},"title":"\u3010C#\u3011\u3010\u6570\u72ec\u3011\u7d42\u4e86\u5224\u5b9a\u3092\u5b9f\u88c5\u3059\u308b","author":"taki","date":"2020\u5e741\u670817\u65e5","format":false,"excerpt":"\u524d\u56de\u307e\u3067\u306e\u72b6\u6cc1\u306f\u3053\u3061\u3089 https:\/\/taki-lab.site\/bocci\/?p=2155 \u6700\u65b0\u2026","rel":"","context":"C#","block_context":{"text":"C#","link":"https:\/\/taki-lab.site\/bocci\/?cat=174"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/taki-lab.site\/bocci\/wp-content\/uploads\/2020\/01\/59bad13c00fb641220042393e7e563be.jpg?resize=350%2C200","width":350,"height":200},"classes":[]},{"id":5005,"url":"https:\/\/taki-lab.site\/bocci\/?p=5005","url_meta":{"origin":1646,"position":4},"title":"\u3010\u30c7\u30b6\u30a4\u30f3\u30d1\u30bf\u30fc\u30f3\u3011Chain of Responsibility\u30d1\u30bf\u30fc\u30f3","author":"taki","date":"2021\u5e741\u670829\u65e5","format":false,"excerpt":"Chain of Responsibility\u306e\u30b5\u30f3\u30d7\u30eb\u30b3\u30fc\u30c9\u3067\u3059\u3002 package org.exa\u2026","rel":"","context":"\u30c7\u30b6\u30a4\u30f3\u30d1\u30bf\u30fc\u30f3","block_context":{"text":"\u30c7\u30b6\u30a4\u30f3\u30d1\u30bf\u30fc\u30f3","link":"https:\/\/taki-lab.site\/bocci\/?cat=225"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":2982,"url":"https:\/\/taki-lab.site\/bocci\/?p=2982","url_meta":{"origin":1646,"position":5},"title":"\u3010C#\u3011\u3010\u30d4\u30af\u30ed\u30b9\u3011\u3010ALTSEED\u3011\u89e3\u6790\u30d1\u30bf\u30fc\u30f3\u305d\u306e\uff13","author":"taki","date":"2020\u5e745\u670819\u65e5","format":false,"excerpt":"\u524d\u56de\u307e\u3067\u306e\u72b6\u6cc1\u306f\u3053\u3061\u3089\u3002 https:\/\/taki-lab.site\/bocci\/?p=2966 \u6700\u2026","rel":"","context":"C#","block_context":{"text":"C#","link":"https:\/\/taki-lab.site\/bocci\/?cat=174"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/taki-lab.site\/bocci\/wp-content\/uploads\/2020\/05\/0aba07696037509aaefc9cd1bb3545b2.jpg?resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/taki-lab.site\/bocci\/wp-content\/uploads\/2020\/05\/0aba07696037509aaefc9cd1bb3545b2.jpg?resize=350%2C200 1x, https:\/\/i0.wp.com\/taki-lab.site\/bocci\/wp-content\/uploads\/2020\/05\/0aba07696037509aaefc9cd1bb3545b2.jpg?resize=525%2C300 1.5x"},"classes":[]}],"jetpack_likes_enabled":true,"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/taki-lab.site\/bocci\/index.php?rest_route=\/wp\/v2\/posts\/1646","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/taki-lab.site\/bocci\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/taki-lab.site\/bocci\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/taki-lab.site\/bocci\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/taki-lab.site\/bocci\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1646"}],"version-history":[{"count":1,"href":"https:\/\/taki-lab.site\/bocci\/index.php?rest_route=\/wp\/v2\/posts\/1646\/revisions"}],"predecessor-version":[{"id":1647,"href":"https:\/\/taki-lab.site\/bocci\/index.php?rest_route=\/wp\/v2\/posts\/1646\/revisions\/1647"}],"wp:attachment":[{"href":"https:\/\/taki-lab.site\/bocci\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1646"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/taki-lab.site\/bocci\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1646"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/taki-lab.site\/bocci\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1646"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}