鍛冶 ダメージ範囲 » 履歴 » バージョン 1
Noppi, 2023/12/18 11:36
1 | 1 | Noppi | [ホーム](https://redmine.noppi.jp) - [[Wiki|DQX]] |
---|---|---|---|
2 | # [[鍛冶 ダメージ範囲]] |
||
3 | ``` scheme |
||
4 | #!r6rs |
||
5 | #!chezscheme |
||
6 | |||
7 | (import (chezscheme)) |
||
8 | |||
9 | (define (make-sequence n1 n2 inc) |
||
10 | (let loop ([current n2] |
||
11 | [lis '()]) |
||
12 | (if (< current n1) |
||
13 | lis |
||
14 | (loop (- current inc) (cons current lis))))) |
||
15 | |||
16 | (define base-normal (make-sequence 12 18 1)) |
||
17 | (define temperature-list (make-sequence 50 2000 50)) |
||
18 | (define temperature-list-neppu (make-sequence 150 2000 50)) |
||
19 | |||
20 | (define (make-2bai n) (* n 2)) |
||
21 | (define base-2bai (map make-2bai base-normal)) |
||
22 | |||
23 | (define (make-3bai n) (* n 3)) |
||
24 | (define base-3bai (map make-3bai base-normal)) |
||
25 | |||
26 | (define (make-1.2 n) (exact (floor (+ (* n 1.2) 1)))) |
||
27 | (define base-1.2 (map make-1.2 base-normal)) |
||
28 | |||
29 | (define (make-tekagen n) (exact (ceiling (* n 0.5)))) |
||
30 | (define base-tekagen (map make-tekagen base-normal)) |
||
31 | |||
32 | (define (make-midare n) (exact (floor (+ (* n 0.8) 1)))) |
||
33 | (define base-midare (map make-midare base-normal)) |
||
34 | |||
35 | (define (make-neppu n) (exact (ceiling (* n 2.5)))) |
||
36 | (define base-neppu (map make-neppu base-normal)) |
||
37 | |||
38 | (define (make-damage-list temperature base-list) |
||
39 | (map |
||
40 | (lambda (n) |
||
41 | (exact (ceiling (* n (+ 1 (* (- temperature 1000) 0.0005)))))) |
||
42 | base-list)) |
||
43 | |||
44 | (define (make-damage-table temperature-list base-list) |
||
45 | (let loop ([temperature-list temperature-list] |
||
46 | [lis '()]) |
||
47 | (if (null? temperature-list) |
||
48 | lis |
||
49 | (let ([current-temperature (car temperature-list)]) |
||
50 | (loop |
||
51 | (cdr temperature-list) |
||
52 | (cons |
||
53 | (list |
||
54 | current-temperature |
||
55 | (make-damage-list current-temperature base-list)) |
||
56 | lis)))))) |
||
57 | |||
58 | (define normal-table (make-damage-table temperature-list base-normal)) |
||
59 | (define 2bai-table (make-damage-table temperature-list base-2bai)) |
||
60 | (define 3bai-table (make-damage-table temperature-list base-3bai)) |
||
61 | (define 1.2-table (make-damage-table temperature-list base-1.2)) |
||
62 | (define tekagen-table (make-damage-table temperature-list base-tekagen)) |
||
63 | (define midare-table (make-damage-table temperature-list base-midare)) |
||
64 | (define neppu-table (make-damage-table temperature-list-neppu base-neppu)) |
||
65 | |||
66 | (define (make-damage-range damage-table) |
||
67 | (let loop ([damage-table damage-table] |
||
68 | [table '()]) |
||
69 | (if (null? damage-table) |
||
70 | (reverse table) |
||
71 | (let ([current-line (car damage-table)]) |
||
72 | (let ([current-damage-list (cadr current-line)]) |
||
73 | (loop |
||
74 | (cdr damage-table) |
||
75 | (cons |
||
76 | (list |
||
77 | (car current-line) |
||
78 | (list |
||
79 | (apply min current-damage-list) |
||
80 | (apply max current-damage-list))) |
||
81 | table))))))) |
||
82 | |||
83 | (define normal-range (make-damage-range normal-table)) |
||
84 | (define 2bai-range (make-damage-range 2bai-table)) |
||
85 | (define 3bai-range (make-damage-range 3bai-table)) |
||
86 | (define 1.2-range (make-damage-range 1.2-table)) |
||
87 | (define tekagen-range (make-damage-range tekagen-table)) |
||
88 | (define midare-range (make-damage-range midare-table)) |
||
89 | (define neppu-range (make-damage-range neppu-table)) |
||
90 | |||
91 | (define (display-range title range) |
||
92 | (display title) |
||
93 | (newline) |
||
94 | (display "----------------------------------------\n") |
||
95 | (let loop ([range range]) |
||
96 | (cond |
||
97 | [(null? range) |
||
98 | (display "----------------------------------------\n") |
||
99 | (newline)] |
||
100 | [else |
||
101 | (let ([line (car range)]) |
||
102 | (display (car line)) |
||
103 | (display "℃") |
||
104 | (display " : ") |
||
105 | (let ([current-range-list (cadr line)]) |
||
106 | (display (car current-range-list)) |
||
107 | (display " ~ ") |
||
108 | (display (cadr current-range-list)) |
||
109 | (newline) |
||
110 | (loop (cdr range))))]))) |
||
111 | |||
112 | (display-range "たたく、ねらい打ち" normal-range) |
||
113 | (display-range "2倍打ち、超4連打ち" 2bai-range) |
||
114 | (display-range "3倍打ち" 3bai-range) |
||
115 | (display-range "上下打ち、4連打ち、ななめ打ち" 1.2-range) |
||
116 | (display-range "てかげん打ち" tekagen-range) |
||
117 | (display-range "みだれ打ち" midare-range) |
||
118 | (display-range "熱風おろし" neppu-range) |
||
119 | ``` |