<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" lang xml:lang>
<head>
  <meta charset="utf-8" />
  <meta name="generator" content="pandoc" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes" />
  <title>一点点点基础</title>
  <style>
code{white-space: pre-wrap;}
span.smallcaps{font-variant: small-caps;}
div.columns{display: flex; gap: min(4vw, 1.5em);}
div.column{flex: auto; overflow-x: auto;}
div.hanging-indent{margin-left: 1.5em; text-indent: -1.5em;}

ul.task-list[class]{list-style: none;}
ul.task-list li input[type="checkbox"] {
font-size: inherit;
width: 0.8em;
margin: 0 0.8em 0.2em -1.6em;
vertical-align: middle;
}
.display.math{display: block; text-align: center; margin: 0.5rem auto;}
</style>
  <style type="text/css">@media screen and (min-aspect-ratio:1/1) {html {background-color: f8f8f8;background-image:linear-gradient(45deg, #eee 25%, transparent 25%, transparent 75%, #eee 75%), linear-gradient(45deg, #eee 25%, transparent 25%, transparent 75%, #eee 75%);background-size: 8px 8px;background-position: 0 0, 16px 8px;}body {border: solid #a0a0a0 1px ;border-radius: 20px ;padding: 26px ;margin: 16px ;color: #101010 ;background: linear-gradient(to right, #efefefff, #efefeffc);padding: 2em 11%;line-height: 2.1em;box-shadow: 0px 0px 1px rgba(160, 160, 160, 1), 0px 0px 1px rgba(160, 160, 160, 1);}}h1,h2,h3,h4,h5,h6 {font-size: 1.5em;color: #3F5770;border-bottom: 1px solid #dddddd;margin: 1.2em 0em;}a {list-style: none;border-right: 0.3em solid #5183C466;border-left: 0.3em solid #5183C466;padding: 0.2em 0.4em;margin-bottom: 0.2em;margin-top: 0.3em;background-color: white;text-decoration-color: blue;border-radius: 0.2em;}a:visited {color: blue;text-decoration-color: white;}a:active {color: red;}nav ul li {margin: 1.2em 0em;}p::before {}p {margin: 1.2em 0;}.title {background-color: white;font-size: 2em;text-align: center;}b {background-color: white;list-style: none;border-right: 0.3em solid #5183C466;border-left: 0.3em solid #5183C466;padding: 0.2em 0.4em;margin-bottom: 0.2em;margin-top: 0.3em;border-radius: 0.2em;}details {border-bottom: 1px solid #dddddd;}details > summary {list-style: none;border-right: 0.3em solid #5183C466;border-left: 0.3em solid #5183C466;padding: 0.2em 0.4em;margin-bottom: 0.2em;margin-top: 0.3em;outline: none;border-radius: 0.2em;}pre {background: #f6f6f6;border-left: 0.5em solid #ccc;padding: 0.4em;border-radius: 0.2em;overflow-wrap:break-word;}pre:active {color: red;}code {font-family: "Verdana";}button {background: #ffffff;color: #20894d;}button:active {color: red;}</style>
  <!--[if lt IE 9]>
    <script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv-printshiv.min.js"></script>
  <![endif]-->
</head>
<body>
<nav id="TOC" role="doc-toc">
<ul>
<li><a href="#一点点点基础" id="toc-一点点点基础"><span class="toc-section-number">1</span> 一点点点基础</a>
<ul>
<li><a href="#添加卡片" id="toc-添加卡片"><span class="toc-section-number">1.1</span> 添加卡片</a></li>
<li><a href="#注册效果" id="toc-注册效果"><span class="toc-section-number">1.2</span> 注册效果</a></li>
<li><a href="#效果描述" id="toc-效果描述"><span class="toc-section-number">1.3</span> 效果描述</a></li>
<li><a href="#效果参数" id="toc-效果参数"><span class="toc-section-number">1.4</span> 效果参数</a></li>
<li><a href="#效果检查" id="toc-效果检查"><span class="toc-section-number">1.5</span> 效果检查</a></li>
<li><a href="#火球" id="toc-火球"><span class="toc-section-number">1.6</span> 火球</a></li>
<li><a href="#叛逆之罪宝-蛇眼" id="toc-叛逆之罪宝-蛇眼"><span class="toc-section-number">1.7</span> 叛逆之罪宝-蛇眼</a></li>
<li><a href="#废铁死亡恶魔" id="toc-废铁死亡恶魔"><span class="toc-section-number">1.8</span> 废铁死亡恶魔</a></li>
<li><a href="#虫饵" id="toc-虫饵"><span class="toc-section-number">1.9</span> 虫饵</a></li>
<li><a href="#天底的使徒" id="toc-天底的使徒"><span class="toc-section-number">1.10</span> 天底的使徒</a></li>
</ul></li>
</ul>
</nav>
<h1 data-number="1" id="一点点点基础"><span class="header-section-number">1</span> 一点点点基础</h1>
<h2 data-number="1.1" id="添加卡片"><span class="header-section-number">1.1</span> 添加卡片</h2>
<p>青眼白龙的卡密是 89631139 ，但查不到 c89631139.lua 。</p>
<p>估计<b>只需要</b>更改 cards.cdb ，就可以添加卡片了。</p>
<hr />
<p>c89631139 的 c 是指 card ，就是「卡片」。</p>
<h2 data-number="1.2" id="注册效果"><span class="header-section-number">1.2</span> 注册效果</h2>
<p>火球的效果足够简单，就以火球为例。</p>
<p>火球里有很多函数，但并没有启用这些函数的语句，这表明它们自己单独是不能运行的，而是<b>被</b>其他的东西给调用。</p>
<p>在 c46130346.lua ，有以下效果：</p>
<pre><code>function c46130346.initial_effect(c)
end</code></pre>
<p>它被 interpreter.cpp 所调用：</p>
<pre><code>call_card_function(pcard, &quot;initial_effect&quot;, 1, 0);</code></pre>
<hr />
<p>c46130346.initial_effect 不利于复制粘贴。</p>
<p>在 utility.lua 有：</p>
<pre><code>function GetID()
end</code></pre>
<p>所以可以这样注册效果：</p>
<pre><code>local s,id,o=GetID()
function s.initial_effect(c)
end</code></pre>
<h2 data-number="1.3" id="效果描述"><span class="header-section-number">1.3</span> 效果描述</h2>
<p>诸如 SetProperty ，其参数可以在 <b>constant.lua</b> 查。</p>
<hr />
<p>简单的描述就写简单一点，复杂的描述就写复杂一点。</p>
<h2 data-number="1.4" id="效果参数"><span class="header-section-number">1.4</span> 效果参数</h2>
<p>在 processor.cpp
可以看到，有时给函数传参数的时候传的是匿名参数，所以很多时候，这些参数其实是<b>空</b>的。</p>
<pre><code>e effect
tp this player
eg event group
ep event player
ev event value
re reason effect
r reason
rp reason player
chk check
chkc check card</code></pre>
<hr />
<p>0 指先攻玩家， 1 指后攻玩家，这是绝对的。</p>
<p>tp 指我方玩家， 1 - tp 指对方玩家，这是相对的。</p>
<hr />
<p>这套效果参数，可以看作是一个规范，目的是为了便于看懂与复制代码。</p>
<h2 data-number="1.5" id="效果检查"><span class="header-section-number">1.5</span> 效果检查</h2>
<pre><code>function c46130346.damtg(e,tp,eg,ep,ev,re,r,rp,chk)
  if chk==0 then return 233333333 end
  233333333
end</code></pre>
<p>这个函数，我觉得应该看作<b>两个</b>函数。</p>
<p>它在 chk 的值不同时，执行不同的分支。</p>
<p>而 chk 取决于效果执行的阶段：检查阶段与执行阶段。</p>
<h2 data-number="1.6" id="火球"><span class="header-section-number">1.6</span> 火球</h2>
<pre><code>function c46130346.damtg(e,tp,eg,ep,ev,re,r,rp,chk)
    if chk==0 then return true end
    Duel.SetTargetPlayer(1-tp)
    Duel.SetTargetParam(500)
    Duel.SetOperationInfo(0,CATEGORY_DAMAGE,nil,0,1-tp,500)
end</code></pre>
<hr />
<p>把：</p>
<pre><code>if chk==0 then return true end</code></pre>
<p>改成：</p>
<pre><code>if chk==0 then return false end</code></pre>
<p>则无法发动火球。</p>
<hr />
<p>去掉：</p>
<pre><code>Duel.SetOperationInfo(0,CATEGORY_DAMAGE,nil,0,1-tp,500)</code></pre>
<p>则无法<b>对应火球</b>而发动痛魂之咒术。</p>
<hr />
<p>去掉</p>
<pre><code>e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)</code></pre>
<p>则无法对应火球而发动精灵之镜。</p>
<h2 data-number="1.7" id="叛逆之罪宝-蛇眼"><span class="header-section-number">1.7</span> 叛逆之罪宝-蛇眼</h2>
<p>去掉：</p>
<pre><code>e1:SetCountLimit(1,id+EFFECT_COUNT_CODE_OATH)</code></pre>
<p>则可以发动多次。</p>
<hr />
<p>去掉：</p>
<pre><code>e1:SetDescription(aux.Stringid(id,0))</code></pre>
<p>则没有变化。</p>
<hr />
<p>去掉：</p>
<pre><code>Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP)</code></pre>
<p>则提示文本发生改变。</p>
<p>这些提示文本可以在 constant.lua 中<b>找到</b>。</p>
<hr />
<p>去掉：</p>
<pre><code>e1:SetValue(TYPE_SPELL+TYPE_CONTINUOUS)</code></pre>
<p>则旋风无法破坏那些怪兽。</p>
<hr />
<p>去掉：</p>
<pre><code>e1:SetReset(RESET_EVENT+RESETS_STANDARD-RESET_TURN_SET)</code></pre>
<p>则那些怪兽离开场上后仍然被当作永续魔法卡。</p>
<h2 data-number="1.8" id="废铁死亡恶魔"><span class="header-section-number">1.8</span> 废铁死亡恶魔</h2>
<p>去掉：</p>
<pre><code>c:EnableReviveLimit()</code></pre>
<p>则<b>没有</b>苏生限制。</p>
<h2 data-number="1.9" id="虫饵"><span class="header-section-number">1.9</span> 虫饵</h2>
<p>去掉：</p>
<pre><code>e2:SetCode(EFFECT_CANNOT_SUMMON)</code></pre>
<p>则<b>不会</b>封锁召唤。</p>
<h2 data-number="1.10" id="天底的使徒"><span class="header-section-number">1.10</span> 天底的使徒</h2>
<p>去掉：</p>
<pre><code>e1:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON)</code></pre>
<p>则我方<b>仍然</b>可从额外卡组特殊召唤怪兽。</p>
<hr />
<p>去掉：</p>
<pre><code>e1:SetReset(RESET_PHASE+PHASE_END)</code></pre>
<p>则我方一直被限制特召。</p>
<script>

document.onclick = function(event) {

  var target = event.target

  if (target.tagName == "PRE"
  || target.tagName == "CODE") {
    if (window.getSelection().toString() !== "") {
      return
      }
    var range = document.createRange();
    range.selectNodeContents(target);
    window.getSelection().removeAllRanges();
    window.getSelection().addRange(range);
    var successful = document.execCommand("copy");
    target.removeAttribute("contenteditable");
    window.getSelection().removeAllRanges();
    }

  }

</script>
</body>
</html>
