{"id":566,"date":"2026-07-09T17:33:27","date_gmt":"2026-07-09T08:33:27","guid":{"rendered":"https:\/\/software.satoshis.jp\/?p=566"},"modified":"2026-07-09T17:33:27","modified_gmt":"2026-07-09T08:33:27","slug":"java%e3%81%a7rpg%e3%82%92%e4%bd%9c%e3%82%8b%ef%bd%9c%e3%83%95%e3%82%a3%e3%83%bc%e3%83%ab%e3%83%89%e3%81%a7%e3%80%8c%e3%82%84%e3%81%8f%e3%81%9d%e3%81%86%e3%80%8d%e3%82%92%e6%8b%be%e3%81%88%e3%82%8b","status":"publish","type":"post","link":"https:\/\/software.satoshis.jp\/?p=566","title":{"rendered":"Java\u3067RPG\u3092\u4f5c\u308b\uff5c\u30d5\u30a3\u30fc\u30eb\u30c9\u3067\u300c\u3084\u304f\u305d\u3046\u300d\u3092\u62fe\u3048\u308b\u3088\u3046\u306b\u3057\u3088\u3046"},"content":{"rendered":"<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/software.satoshis.jp\/wp-content\/uploads\/2026\/07\/rpg-java-7-300x157.png\" alt=\"\" width=\"300\" height=\"157\" class=\"alignnone size-medium wp-image-568\" srcset=\"https:\/\/software.satoshis.jp\/wp-content\/uploads\/2026\/07\/rpg-java-7-300x157.png 300w, https:\/\/software.satoshis.jp\/wp-content\/uploads\/2026\/07\/rpg-java-7-1024x536.png 1024w, https:\/\/software.satoshis.jp\/wp-content\/uploads\/2026\/07\/rpg-java-7-768x402.png 768w, https:\/\/software.satoshis.jp\/wp-content\/uploads\/2026\/07\/rpg-java-7.png 1280w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/p>\n<p>\u524d\u56de\u306f\u3001\u6575\u306e\u7a2e\u985e\u3092\u5897\u3084\u3057\u3066\u3001\u30b9\u30e9\u30a4\u30e0\u4ee5\u5916\u306b\u30b4\u30fc\u30b9\u30c8\u3082\u767b\u5834\u3059\u308b\u3088\u3046\u306b\u3057\u307e\u3057\u305f\u3002<\/p>\n<p>Slime \u3082 Ghost \u3082 Chara \u3092\u7d99\u627f\u3057\u3066\u3044\u308b\u305f\u3081\u3001\u6226\u95d8\u51e6\u7406\u3067\u306f\u3069\u3061\u3089\u3082 Chara \u3068\u3057\u3066\u6271\u3046\u3053\u3068\u304c\u3067\u304d\u307e\u3057\u305f\u3002<\/p>\n<p>\u3053\u308c\u306b\u3088\u308a\u3001\u6575\u306e\u7a2e\u985e\u3092\u5897\u3084\u3057\u3066\u3082\u3001\u6226\u95d8\u51e6\u7406\u306e\u591a\u304f\u3092\u305d\u306e\u307e\u307e\u4f7f\u3048\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3057\u305f\u3002<\/p>\n<p>\u307e\u305f\u3001\u540c\u3058\u624b\u9806\u3067\u6575\u306e\u7a2e\u985e\u3092\u5897\u3084\u305b\u308b\u3053\u3068\u304c\u308f\u304b\u308a\u307e\u3057\u305f\u3002<\/p>\n<p>\u4eca\u56de\u306f\u3001\u6575\u3067\u306f\u306a\u304f\u30a2\u30a4\u30c6\u30e0\u3092\u8ffd\u52a0\u3057\u3066\u307f\u307e\u3059\u3002<\/p>\n<p>RPG\u3067\u306f\u3001\u30d5\u30a3\u30fc\u30eb\u30c9\u3092\u6b69\u3044\u3066\u3044\u308b\u3068\u3001\u305f\u307e\u306b\u30a2\u30a4\u30c6\u30e0\u3092\u62fe\u3046\u3053\u3068\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n<p>\u305d\u3053\u3067\u4eca\u56de\u306f\u3001\u52c7\u8005\u304c\u30d5\u30a3\u30fc\u30eb\u30c9\u4e0a\u3092\u79fb\u52d5\u3057\u305f\u3068\u304d\u306b\u3001\u4e00\u5b9a\u306e\u78ba\u7387\u3067\u300c\u3084\u304f\u305d\u3046\u300d\u3092\u62fe\u3048\u308b\u3088\u3046\u306b\u3057\u307e\u3059\u3002<\/p>\n<h3>\u30a2\u30a4\u30c6\u30e0\u306f\u8ab0\u304c\u6301\u3064\u306e\u304b<\/h3>\n<p>\u4eca\u56de\u306f\u3001\u30d5\u30a3\u30fc\u30eb\u30c9\u3092\u6b69\u3044\u3066\u3044\u308b\u3068\u3001\u305f\u307e\u306b\u3084\u304f\u305d\u3046\u3092\u62fe\u3048\u308b\u3088\u3046\u306b\u3057\u307e\u3059\u3002<\/p>\n<p>\u3053\u3053\u3067\u5c11\u3057\u8003\u3048\u305f\u3044\u306e\u304c\u3001<\/p>\n<blockquote><p>\u62fe\u3063\u305f\u30a2\u30a4\u30c6\u30e0\u306f\u3001\u3069\u306e\u30af\u30e9\u30b9\u304c\u6301\u3064\u3079\u304d\u304b<\/p><\/blockquote>\n<p>\u3068\u3044\u3046\u70b9\u3067\u3059\u3002<\/p>\n<p>\u601d\u3044\u3064\u304f\u306e\u306f\u3001Rpg \u30af\u30e9\u30b9\u306b\u30a2\u30a4\u30c6\u30e0\u4e00\u89a7\u3092\u6301\u305f\u305b\u308b\u65b9\u6cd5\u3067\u3059\u3002<\/p>\n<p>Rpg \u306f\u30b2\u30fc\u30e0\u5168\u4f53\u306e\u72b6\u614b\u3092\u7ba1\u7406\u3057\u3066\u3044\u308b\u306e\u3067\u3001\u305d\u3053\u306b\u6301\u305f\u305b\u3066\u3082\u52d5\u304d\u307e\u3059\u3002<\/p>\n<p>\u305f\u3060\u3001\u4eca\u56de\u3084\u304f\u305d\u3046\u3092\u62fe\u3046\u306e\u306f\u52c7\u8005\u3067\u3059\u3002<\/p>\n<p>\u305d\u3057\u3066\u3001\u4eca\u5f8c\u3084\u304f\u305d\u3046\u3092\u4f7f\u3046\u3068\u3057\u305f\u3089\u3001\u4f7f\u3046\u306e\u3082\u52c7\u8005\u3067\u3059\u3002<\/p>\n<p>\u305d\u3046\u8003\u3048\u308b\u3068\u3001\u30a2\u30a4\u30c6\u30e0\u3092\u6301\u3064\u306e\u306f Rpg \u3067\u306f\u306a\u304f\u3001Hero \u306e\u65b9\u304c\u81ea\u7136\u3067\u3059\u3002<\/p>\n<p>\u305d\u3053\u3067\u4eca\u56de\u306f\u3001\u62fe\u3063\u305f\u30a2\u30a4\u30c6\u30e0\u3092 Hero \u306b\u6301\u305f\u305b\u308b\u3088\u3046\u306b\u3057\u307e\u3059\u3002<\/p>\n<h3>Item\u30af\u30e9\u30b9\u3092\u4f5c\u308b<\/h3>\n<p>\u307e\u305a\u3001\u30a2\u30a4\u30c6\u30e0\u5171\u901a\u306e\u30af\u30e9\u30b9\u3068\u3057\u3066 Item \u3092\u4f5c\u308a\u307e\u3059\u3002<\/p>\n<pre class=\"brush: java; title: ; notranslate\" title=\"\">\r\npublic class Item {\r\n    private String name;\r\n\r\n    public Item(String name) {\r\n        this.name = name;\r\n    }\r\n\r\n    public String getName() {\r\n        return name;\r\n    }\r\n}\r\n<\/pre>\n<p>Item \u306f\u3001\u30a2\u30a4\u30c6\u30e0\u540d\u3092\u6301\u3064\u30af\u30e9\u30b9\u3067\u3059\u3002<\/p>\n<p>\u30b3\u30f3\u30b9\u30c8\u30e9\u30af\u30bf\u3067\u3001\u30a2\u30a4\u30c6\u30e0\u540d\u3092\u53d7\u3051\u53d6\u308a\u307e\u3059\u3002<\/p>\n<pre class=\"brush: java; gutter: false; title: ; notranslate\" title=\"\">\r\npublic Item(String name) {\r\n    this.name = name;\r\n}\r\n<\/pre>\n<p>\u305d\u3057\u3066\u3001\u30a2\u30a4\u30c6\u30e0\u540d\u3092\u53d6\u5f97\u3059\u308b\u305f\u3081\u306b getName() \u30e1\u30bd\u30c3\u30c9\u3092\u7528\u610f\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<pre class=\"brush: java; gutter: false; title: ; notranslate\" title=\"\">\r\npublic String getName() {\r\n    return name;\r\n}\r\n<\/pre>\n<p>\u4eca\u56de\u306f\u307e\u3060\u3001\u30a2\u30a4\u30c6\u30e0\u540d\u3060\u3051\u3092\u6301\u3064\u30b7\u30f3\u30d7\u30eb\u306a\u30af\u30e9\u30b9\u306b\u3057\u3066\u304a\u304d\u307e\u3059\u3002<\/p>\n<h3>\u3084\u304f\u305d\u3046\u3092\u8868\u3059Herb\u30af\u30e9\u30b9\u3092\u4f5c\u308b<\/h3>\n<p>\u6b21\u306b\u3001\u3084\u304f\u305d\u3046\u3092\u8868\u3059 Herb \u30af\u30e9\u30b9\u3092\u4f5c\u308a\u307e\u3059\u3002<\/p>\n<pre class=\"brush: java; title: ; notranslate\" title=\"\">\r\npublic class Herb extends Item {\r\n    public Herb() {\r\n        super(&quot;\u3084\u304f\u305d\u3046&quot;);\r\n    }\r\n}\r\n<\/pre>\n<p>Herb \u306f Item \u3092\u7d99\u627f\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<pre class=\"brush: java; gutter: false; title: ; notranslate\" title=\"\">\r\npublic class Herb extends Item {\r\n<\/pre>\n<p>\u3064\u307e\u308a\u3001\u3084\u304f\u305d\u3046\u306f\u30a2\u30a4\u30c6\u30e0\u306e\u4e00\u7a2e\u3067\u3059\u3002<\/p>\n<p>Item \u306e\u30b3\u30f3\u30b9\u30c8\u30e9\u30af\u30bf\u306b\u306f\u30a2\u30a4\u30c6\u30e0\u540d\u3092\u6e21\u3059\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n<p>\u305d\u306e\u305f\u3081\u3001Herb \u306e\u30b3\u30f3\u30b9\u30c8\u30e9\u30af\u30bf\u3067\u306f\u3001\u89aa\u30af\u30e9\u30b9\u306e\u30b3\u30f3\u30b9\u30c8\u30e9\u30af\u30bf\u306b &#8220;\u3084\u304f\u305d\u3046&#8221; \u3092\u6e21\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<pre class=\"brush: java; gutter: false; title: ; notranslate\" title=\"\">\r\nsuper(&quot;\u3084\u304f\u305d\u3046&quot;);\r\n<\/pre>\n<p>\u3053\u308c\u3067\u3001`new Herb()` \u3068\u66f8\u304f\u3060\u3051\u3067\u3001\u540d\u524d\u304c\u300c\u3084\u304f\u305d\u3046\u300d\u306e\u30a2\u30a4\u30c6\u30e0\u3092\u4f5c\u308c\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<pre class=\"brush: java; gutter: false; title: ; notranslate\" title=\"\">\r\nItem item = new Herb();\r\n<\/pre>\n<h3>Hero\u30af\u30e9\u30b9\u306b\u30a2\u30a4\u30c6\u30e0\u3092\u6301\u305f\u305b\u308b<\/h3>\n<p>\u6b21\u306b\u3001Hero \u30af\u30e9\u30b9\u3092\u4fee\u6b63\u3057\u307e\u3059\u3002<\/p>\n<p>\u62fe\u3063\u305f\u30a2\u30a4\u30c6\u30e0\u306f\u52c7\u8005\u304c\u6301\u3064\u3088\u3046\u306b\u3057\u305f\u3044\u306e\u3067\u3001Hero \u306b\u30a2\u30a4\u30c6\u30e0\u4e00\u89a7\u3092\u8ffd\u52a0\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"brush: java; title: ; notranslate\" title=\"\">\r\nimport java.util.ArrayList;\r\nimport java.util.List;\r\n\r\npublic class Hero extends Chara {\r\n    private List&lt;Item&gt; items = new ArrayList&lt;&gt;();\r\n\r\n    public Hero() {\r\n        name = &quot;\u52c7\u8005&quot;;\r\n        hp = 30;\r\n        attackPower = 10;\r\n    }\r\n\r\n    public void addItem(Item item) {\r\n        items.add(item);\r\n    }\r\n\r\n    public int getItemCount() {\r\n        return items.size();\r\n    }\r\n}\r\n<\/pre>\n<p>\u4eca\u56de\u8ffd\u52a0\u3057\u305f\u306e\u306f\u3001\u3053\u306e\u90e8\u5206\u3067\u3059\u3002<\/p>\n<pre class=\"brush: java; gutter: false; title: ; notranslate\" title=\"\">\r\nprivate List&lt;Item&gt; items = new ArrayList&lt;&gt;();\r\n<\/pre>\n<p>items \u306f\u3001\u52c7\u8005\u304c\u6301\u3063\u3066\u3044\u308b\u30a2\u30a4\u30c6\u30e0\u306e\u4e00\u89a7\u3067\u3059\u3002<\/p>\n<p>List<Item> \u3068\u3057\u3066\u3044\u308b\u306e\u3067\u3001\u3084\u304f\u305d\u3046\u4ee5\u5916\u306e\u30a2\u30a4\u30c6\u30e0\u3082\u540c\u3058\u4e00\u89a7\u306b\u5165\u308c\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<pre class=\"brush: java; gutter: false; title: ; notranslate\" title=\"\">\r\nitems.add(new Herb());\r\n<\/pre>\n<p>\u30a2\u30a4\u30c6\u30e0\u3092\u8ffd\u52a0\u3059\u308b\u305f\u3081\u306b\u3001addItem() \u30e1\u30bd\u30c3\u30c9\u3092\u4f5c\u308a\u307e\u3059\u3002<\/p>\n<pre class=\"brush: java; gutter: false; title: ; notranslate\" title=\"\">\r\npublic void addItem(Item item) {\r\n    items.add(item);\r\n}\r\n<\/pre>\n<p>\u3053\u308c\u3067\u3001\u52c7\u8005\u306b\u30a2\u30a4\u30c6\u30e0\u3092\u6301\u305f\u305b\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<pre class=\"brush: java; gutter: false; title: ; notranslate\" title=\"\">\r\nhero.addItem(new Herb());\r\n<\/pre>\n<p>\u307e\u305f\u3001\u4eca\u3044\u304f\u3064\u30a2\u30a4\u30c6\u30e0\u3092\u6301\u3063\u3066\u3044\u308b\u304b\u78ba\u8a8d\u3059\u308b\u305f\u3081\u306b\u3001getItemCount() \u3082\u7528\u610f\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<pre class=\"brush: java; gutter: false; title: ; notranslate\" title=\"\">\r\npublic int getItemCount() {\r\n    return items.size();\r\n}\r\n<\/pre>\n<p>\u4eca\u56de\u306f\u3001\u307e\u305a\u30a2\u30a4\u30c6\u30e0\u6570\u3060\u3051\u3092\u78ba\u8a8d\u3067\u304d\u308b\u3088\u3046\u306b\u3057\u3066\u304a\u304d\u307e\u3059\u3002<\/p>\n<p>\u4eca\u5f8c\u3001\u3084\u304f\u305d\u3046\u3092\u4f7f\u3046\u51e6\u7406\u3092\u4f5c\u308b\u3068\u304d\u306b\u306f\u3001\u30a2\u30a4\u30c6\u30e0\u4e00\u89a7\u304b\u3089\u3084\u304f\u305d\u3046\u3092\u53d6\u308a\u51fa\u3057\u305f\u308a\u3001\u4f7f\u3063\u305f\u30a2\u30a4\u30c6\u30e0\u3092\u524a\u9664\u3057\u305f\u308a\u3059\u308b\u51e6\u7406\u3092\u8ffd\u52a0\u3057\u3066\u3044\u304d\u307e\u3059\u3002<\/p>\n<h3>Rpg\u30af\u30e9\u30b9\u3067\u3084\u304f\u305d\u3046\u3092\u898b\u3064\u3051\u308b<\/h3>\n<p>\u6b21\u306b\u3001Rpg \u30af\u30e9\u30b9\u306b\u3001\u3084\u304f\u305d\u3046\u3092\u898b\u3064\u3051\u308b\u51e6\u7406\u3092\u8ffd\u52a0\u3057\u307e\u3059\u3002<\/p>\n<p>\u30a2\u30a4\u30c6\u30e0\u3092\u6301\u3064\u306e\u306f Hero \u3067\u3059\u304c\u3001\u30d5\u30a3\u30fc\u30eb\u30c9\u3092\u6b69\u3044\u3066\u3044\u308b\u3068\u304d\u306b\u30a2\u30a4\u30c6\u30e0\u3092\u898b\u3064\u3051\u308b\u304b\u3069\u3046\u304b\u306f\u3001\u30b2\u30fc\u30e0\u306e\u9032\u884c\u306b\u95a2\u308f\u308b\u51e6\u7406\u3067\u3059\u3002<\/p>\n<p>\u305d\u306e\u305f\u3081\u3001\u30a2\u30a4\u30c6\u30e0\u3092\u898b\u3064\u3051\u308b\u5224\u5b9a\u306f Rpg \u306b\u66f8\u304d\u307e\u3059\u3002<\/p>\n<pre class=\"brush: java; gutter: false; title: ; notranslate\" title=\"\">\r\npublic Item findItem() {\r\n    if (inBattle) {\r\n        return null;\r\n    }\r\n\r\n    int value = random.nextInt(100);\r\n\r\n    if (value &lt; 10) {\r\n        Item item = new Herb();\r\n        hero.addItem(item);\r\n        return item;\r\n    }\r\n\r\n    return null;\r\n}\r\n<\/pre>\n<p>\u307e\u305a\u3001\u6226\u95d8\u4e2d\u306a\u3089\u30a2\u30a4\u30c6\u30e0\u3092\u62fe\u308f\u306a\u3044\u3088\u3046\u306b\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<pre class=\"brush: java; gutter: false; title: ; notranslate\" title=\"\">\r\nif (inBattle) {\r\n    return null;\r\n}\r\n<\/pre>\n<p>\u6b21\u306b\u3001\u4e71\u6570\u3092\u4f5c\u308a\u307e\u3059\u3002<\/p>\n<pre class=\"brush: java; gutter: false; title: ; notranslate\" title=\"\">\r\nint value = random.nextInt(100);\r\n<\/pre>\n<p>random.nextInt(100) \u306f\u30010\u304b\u308999\u307e\u3067\u306e\u6574\u6570\u3092\u30e9\u30f3\u30c0\u30e0\u306b\u8fd4\u3057\u307e\u3059\u3002<\/p>\n<p>\u4eca\u56de\u306f\u3001\u5024\u304c10\u672a\u6e80\u306a\u3089\u3001\u3084\u304f\u305d\u3046\u3092\u62fe\u3046\u3053\u3068\u306b\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"brush: java; gutter: false; title: ; notranslate\" title=\"\">\r\nif (value &lt; 10) {\r\n<\/pre>\n<p>0\u304b\u308999\u307e\u3067\u306e100\u901a\u308a\u306e\u3046\u3061\u30010\u304b\u30899\u307e\u3067\u306e10\u901a\u308a\u3067\u30a2\u30a4\u30c6\u30e0\u3092\u62fe\u3044\u307e\u3059\u3002<\/p>\n<p>\u3064\u307e\u308a\u300110%\u306e\u78ba\u7387\u3067\u3084\u304f\u305d\u3046\u3092\u62fe\u3046\u3053\u3068\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>\u3084\u304f\u305d\u3046\u3092\u62fe\u3063\u305f\u5834\u5408\u306f\u3001Herb \u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092\u4f5c\u308a\u307e\u3059\u3002<\/p>\n<pre class=\"brush: java; gutter: false; title: ; notranslate\" title=\"\">\r\nItem item = new Herb();\r\n<\/pre>\n<p>\u305d\u3057\u3066\u3001\u52c7\u8005\u306b\u6301\u305f\u305b\u307e\u3059\u3002<\/p>\n<pre class=\"brush: java; gutter: false; title: ; notranslate\" title=\"\">\r\nhero.addItem(item);\r\n<\/pre>\n<p>\u6700\u5f8c\u306b\u3001\u62fe\u3063\u305f\u30a2\u30a4\u30c6\u30e0\u3092\u8fd4\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"brush: java; gutter: false; title: ; notranslate\" title=\"\">\r\nreturn item;\r\n<\/pre>\n<p>\u30a2\u30a4\u30c6\u30e0\u3092\u62fe\u308f\u306a\u304b\u3063\u305f\u5834\u5408\u306f\u3001`null` \u3092\u8fd4\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"brush: java; gutter: false; title: ; notranslate\" title=\"\">\r\nreturn null;\r\n<\/pre>\n<h3>Rpg\u30af\u30e9\u30b9\u306e\u4fee\u6b63\u90e8\u5206<\/h3>\n<p>Rpg \u30af\u30e9\u30b9\u306e\u3046\u3061\u3001\u30a2\u30a4\u30c6\u30e0\u62fe\u5f97\u306b\u95a2\u4fc2\u3059\u308b\u90e8\u5206\u306f\u6b21\u306e\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<pre class=\"brush: java; title: ; notranslate\" title=\"\">\r\nimport java.util.Random;\r\n\r\npublic class Rpg {\r\n    public static final int FIELD_WIDTH = 10;\r\n    public static final int FIELD_HEIGHT = 8;\r\n\r\n    private Hero hero;\r\n    private Chara enemy;\r\n\r\n    private int heroX;\r\n    private int heroY;\r\n\r\n    private boolean inBattle;\r\n\r\n    private Random random = new Random();\r\n\r\n    public Rpg() {\r\n        hero = new Hero();\r\n        heroX = 0;\r\n        heroY = 0;\r\n        inBattle = false;\r\n    }\r\n\r\n    public Hero getHero() {\r\n        return hero;\r\n    }\r\n\r\n    public Chara getEnemy() {\r\n        return enemy;\r\n    }\r\n\r\n    public boolean isInBattle() {\r\n        return inBattle;\r\n    }\r\n\r\n    public Item findItem() {\r\n        if (inBattle) {\r\n            return null;\r\n        }\r\n\r\n        int value = random.nextInt(100);\r\n\r\n        if (value &lt; 10) {\r\n            Item item = new Herb();\r\n            hero.addItem(item);\r\n            return item;\r\n        }\r\n\r\n        return null;\r\n    }\r\n}\r\n<\/pre>\n<p>\u3053\u3053\u3067\u5927\u4e8b\u306a\u306e\u306f\u3001Rpg \u304c\u30a2\u30a4\u30c6\u30e0\u4e00\u89a7\u3092\u6301\u3063\u3066\u3044\u306a\u3044\u3053\u3068\u3067\u3059\u3002<\/p>\n<p>\u30a2\u30a4\u30c6\u30e0\u3092\u6301\u3063\u3066\u3044\u308b\u306e\u306f\u3001\u3042\u304f\u307e\u3067 Hero \u3067\u3059\u3002<\/p>\n<p>Rpg \u306f\u3001\u30d5\u30a3\u30fc\u30eb\u30c9\u79fb\u52d5\u4e2d\u306b\u30a2\u30a4\u30c6\u30e0\u3092\u898b\u3064\u3051\u308b\u304b\u3069\u3046\u304b\u3092\u5224\u5b9a\u3057\u3001\u898b\u3064\u3051\u305f\u3089\u52c7\u8005\u306b\u6e21\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<h3>RpgFrame\u3067\u62fe\u3063\u305f\u3053\u3068\u3092\u8868\u793a\u3059\u308b<\/h3>\n<p>\u6b21\u306b\u3001RpgFrame \u3092\u4fee\u6b63\u3057\u307e\u3059\u3002<\/p>\n<p>\u52c7\u8005\u304c\u79fb\u52d5\u3057\u305f\u3042\u3068\u3001\u6575\u3068\u906d\u9047\u3057\u306a\u304b\u3063\u305f\u5834\u5408\u306b\u3001\u30a2\u30a4\u30c6\u30e0\u3092\u62fe\u3046\u5224\u5b9a\u3092\u884c\u3044\u307e\u3059\u3002<\/p>\n<pre class=\"brush: java; gutter: false; title: ; notranslate\" title=\"\">\r\nprivate void checkItem() {\r\n    Item item = rpg.findItem();\r\n\r\n    if (item != null) {\r\n        javax.swing.JOptionPane.showMessageDialog(\r\n                this,\r\n                item.getName() + &quot;\u3092\u62fe\u3063\u305f\uff01\\n\u6301\u3063\u3066\u3044\u308b\u30a2\u30a4\u30c6\u30e0: &quot;\r\n                        + rpg.getHero().getItemCount() + &quot;\u500b&quot;);\r\n    }\r\n}\r\n<\/pre>\n<p>rpg.findItem() \u3092\u547c\u3073\u51fa\u3057\u3066\u3001\u30a2\u30a4\u30c6\u30e0\u3092\u62fe\u3063\u305f\u304b\u3069\u3046\u304b\u3092\u78ba\u8a8d\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"brush: java; gutter: false; title: ; notranslate\" title=\"\">\r\nItem item = rpg.findItem();\r\n<\/pre>\n<p>\u30a2\u30a4\u30c6\u30e0\u3092\u62fe\u308f\u306a\u304b\u3063\u305f\u5834\u5408\u306f\u3001null \u304c\u8fd4\u308a\u307e\u3059\u3002<\/p>\n<p>\u30a2\u30a4\u30c6\u30e0\u3092\u62fe\u3063\u305f\u5834\u5408\u306f\u3001Item \u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u304c\u8fd4\u308a\u307e\u3059\u3002<\/p>\n<p>\u305d\u306e\u305f\u3081\u3001item != null \u3067\u5224\u5b9a\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<pre class=\"brush: java; gutter: false; title: ; notranslate\" title=\"\">\r\nif (item != null) {\r\n<\/pre>\n<p>\u62fe\u3063\u305f\u5834\u5408\u306f\u3001JOptionPane \u3092\u4f7f\u3063\u3066\u30e1\u30c3\u30bb\u30fc\u30b8\u3092\u8868\u793a\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"brush: java; gutter: false; title: ; notranslate\" title=\"\">\r\njavax.swing.JOptionPane.showMessageDialog(\r\n        this,\r\n        item.getName() + &quot;\u3092\u62fe\u3063\u305f\uff01\\n\u6301\u3063\u3066\u3044\u308b\u30a2\u30a4\u30c6\u30e0: &quot;\r\n                + rpg.getHero().getItemCount() + &quot;\u500b&quot;);\r\n<\/pre>\n<p>\u30a2\u30a4\u30c6\u30e0\u6570\u306f\u3001Rpg \u304b\u3089\u52c7\u8005\u3092\u53d6\u5f97\u3057\u3001\u52c7\u8005\u304c\u6301\u3063\u3066\u3044\u308b\u30a2\u30a4\u30c6\u30e0\u6570\u3092\u8868\u793a\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<pre class=\"brush: java; gutter: false; title: ; notranslate\" title=\"\">\r\nrpg.getHero().getItemCount()\r\n<\/pre>\n<p>\u3053\u3053\u3067\u3082\u3001RpgFrame \u304c\u30a2\u30a4\u30c6\u30e0\u4e00\u89a7\u3092\u76f4\u63a5\u6301\u3063\u3066\u3044\u306a\u3044\u3053\u3068\u306b\u6ce8\u76ee\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<p>\u30a2\u30a4\u30c6\u30e0\u3092\u6301\u3063\u3066\u3044\u308b\u306e\u306f Hero \u3067\u3059\u3002<\/p>\n<p>RpgFrame \u306f\u3001\u62fe\u3063\u305f\u3053\u3068\u3092\u753b\u9762\u306b\u8868\u793a\u3057\u3066\u3044\u308b\u3060\u3051\u3067\u3059\u3002<\/p>\n<h3>\u5f79\u5272\u3092\u6574\u7406\u3059\u308b<\/h3>\n<p>\u4eca\u56de\u306e\u5f79\u5272\u3092\u6574\u7406\u3059\u308b\u3068\u3001\u6b21\u306e\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<table>\n<tr>\n<th>\u30af\u30e9\u30b9<\/th>\n<th>\u5f79\u5272<\/th>\n<\/tr>\n<tr>\n<td>Item<\/td>\n<td>\u30a2\u30a4\u30c6\u30e0\u5171\u901a\u306e\u60c5\u5831\u3092\u6301\u3064<\/td>\n<\/tr>\n<tr>\n<td>Herb<\/td>\n<td>\u3084\u304f\u305d\u3046\u3092\u8868\u3059<\/td>\n<\/tr>\n<tr>\n<td>Hero<\/td>\n<td>\u52c7\u8005\u306e\u60c5\u5831\u3068\u3001\u6301\u3063\u3066\u3044\u308b\u30a2\u30a4\u30c6\u30e0\u3092\u7ba1\u7406\u3059\u308b<\/td>\n<\/tr>\n<tr>\n<td>Rpg<\/td>\n<td>\u30d5\u30a3\u30fc\u30eb\u30c9\u79fb\u52d5\u4e2d\u306b\u30a2\u30a4\u30c6\u30e0\u3092\u898b\u3064\u3051\u308b\u304b\u3069\u3046\u304b\u3092\u5224\u5b9a\u3059\u308b<\/td>\n<\/tr>\n<tr>\n<td>RpgFrame<\/td>\n<td>\u30a2\u30a4\u30c6\u30e0\u3092\u62fe\u3063\u305f\u3053\u3068\u3092\u753b\u9762\u306b\u8868\u793a\u3059\u308b<\/td>\n<\/tr>\n<\/table>\n<p>\u30a2\u30a4\u30c6\u30e0\u3092\u6301\u3064\u306e\u306f Hero \u3067\u3059\u3002<\/p>\n<p>\u30a2\u30a4\u30c6\u30e0\u3092\u898b\u3064\u3051\u308b\u304b\u3069\u3046\u304b\u3092\u5224\u5b9a\u3059\u308b\u306e\u306f Rpg \u3067\u3059\u3002<\/p>\n<p>\u30a2\u30a4\u30c6\u30e0\u3092\u62fe\u3063\u305f\u3053\u3068\u3092\u8868\u793a\u3059\u308b\u306e\u306f RpgFrame \u3067\u3059\u3002<\/p>\n<p>\u3053\u306e\u3088\u3046\u306b\u5206\u3051\u308b\u3068\u3001\u305d\u308c\u305e\u308c\u306e\u30af\u30e9\u30b9\u306e\u5f79\u5272\u304c\u5206\u304b\u308a\u3084\u3059\u304f\u306a\u308a\u307e\u3059\u3002<\/p>\n<h3>\u307e\u3068\u3081<\/h3>\n<p>\u4eca\u56de\u306f\u3001\u30d5\u30a3\u30fc\u30eb\u30c9\u3092\u79fb\u52d5\u3057\u305f\u3068\u304d\u306b\u3001\u305f\u307e\u306b\u3084\u304f\u305d\u3046\u3092\u62fe\u3048\u308b\u3088\u3046\u306b\u3057\u307e\u3057\u305f\u3002<\/p>\n<p>\u307e\u305a\u3001\u30a2\u30a4\u30c6\u30e0\u5171\u901a\u306e\u30af\u30e9\u30b9\u3068\u3057\u3066 Item \u3092\u4f5c\u308a\u307e\u3057\u305f\u3002<\/p>\n<p>\u6b21\u306b\u3001\u3084\u304f\u305d\u3046\u3092\u8868\u3059 Herb \u30af\u30e9\u30b9\u3092\u4f5c\u308a\u3001Item \u3092\u7d99\u627f\u3055\u305b\u307e\u3057\u305f\u3002<\/p>\n<p>\u62fe\u3063\u305f\u30a2\u30a4\u30c6\u30e0\u306f\u3001Rpg \u3067\u306f\u306a\u304f Hero \u306b\u6301\u305f\u305b\u308b\u3088\u3046\u306b\u3057\u307e\u3057\u305f\u3002<\/p>\n<p>\u3084\u304f\u305d\u3046\u3092\u62fe\u3063\u305f\u3089\u3001Rpg \u306e findItem() \u306e\u4e2d\u3067 Hero \u306b\u30a2\u30a4\u30c6\u30e0\u3092\u8ffd\u52a0\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"brush: java; gutter: false; title: ; notranslate\" title=\"\">\r\nhero.addItem(item);\r\n<\/pre>\n<p>RpgFrame \u3067\u306f\u3001\u30a2\u30a4\u30c6\u30e0\u3092\u62fe\u3063\u305f\u5834\u5408\u306b\u3001JOptionPane \u3092\u4f7f\u3063\u3066\u30e1\u30c3\u30bb\u30fc\u30b8\u3092\u8868\u793a\u3057\u307e\u3057\u305f\u3002<\/p>\n<p>\u3053\u308c\u3067\u3001\u30d5\u30a3\u30fc\u30eb\u30c9\u3092\u6b69\u3044\u3066\u3044\u308b\u3068\u3001\u305f\u307e\u306b\u3084\u304f\u305d\u3046\u3092\u62fe\u3044\u3001\u52c7\u8005\u304c\u30a2\u30a4\u30c6\u30e0\u3068\u3057\u3066\u4fdd\u6301\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3057\u305f\u3002<\/p>\n<p>\u307e\u3060\u3001\u62fe\u3063\u305f\u3084\u304f\u305d\u3046\u3092\u4f7f\u3046\u3053\u3068\u306f\u3067\u304d\u307e\u305b\u3093\u3002<\/p>\n<p>\u6b21\u56de\u306f\u3001\u6226\u95d8\u4e2d\u306b\u3084\u304f\u305d\u3046\u3092\u4f7f\u3063\u3066\u3001\u52c7\u8005\u306eHP\u3092\u56de\u5fa9\u3067\u304d\u308b\u3088\u3046\u306b\u3057\u3066\u307f\u307e\u3059\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u524d\u56de\u306f\u3001\u6575\u306e\u7a2e\u985e\u3092\u5897\u3084\u3057\u3066\u3001\u30b9\u30e9\u30a4\u30e0\u4ee5\u5916\u306b\u30b4\u30fc\u30b9\u30c8\u3082\u767b\u5834\u3059\u308b\u3088\u3046\u306b\u3057\u307e\u3057\u305f\u3002 Slime \u3082 Ghost \u3082 Chara \u3092\u7d99\u627f\u3057\u3066\u3044\u308b\u305f\u3081\u3001\u6226\u95d8\u51e6\u7406\u3067\u306f\u3069\u3061\u3089\u3082 Chara \u3068\u3057\u3066\u6271\u3046\u3053\u3068\u304c\u3067\u304d\u307e\u3057 &#8230; <\/p>\n","protected":false},"author":1,"featured_media":568,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[71,194,175],"tags":[75,195,11,182,177],"class_list":["post-566","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-java","category-uml","category-175","tag-java","tag-rpg","tag-uml","tag-182","tag-177"],"nelio_content":{"autoShareEndMode":"never","automationSources":{"useCustomSentences":false,"customSentences":[]},"efiAlt":"","efiUrl":"","followers":[1],"highlights":[],"isAutoShareEnabled":true,"networkImageIds":[],"permalinkQueryArgs":[],"series":[],"suggestedReferences":[]},"views":14,"_links":{"self":[{"href":"https:\/\/software.satoshis.jp\/index.php?rest_route=\/wp\/v2\/posts\/566","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/software.satoshis.jp\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/software.satoshis.jp\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/software.satoshis.jp\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/software.satoshis.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=566"}],"version-history":[{"count":2,"href":"https:\/\/software.satoshis.jp\/index.php?rest_route=\/wp\/v2\/posts\/566\/revisions"}],"predecessor-version":[{"id":569,"href":"https:\/\/software.satoshis.jp\/index.php?rest_route=\/wp\/v2\/posts\/566\/revisions\/569"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/software.satoshis.jp\/index.php?rest_route=\/wp\/v2\/media\/568"}],"wp:attachment":[{"href":"https:\/\/software.satoshis.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=566"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/software.satoshis.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=566"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/software.satoshis.jp\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=566"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}